framework icon indicating copy to clipboard operation
framework copied to clipboard

feat(nuxt): server-only components

Open danielroe opened this issue 3 years ago • 5 comments

🔗 Linked issue

  • Pending: https://github.com/nuxt/framework/pull/5689 (Implements: https://github.com/nuxt/framework/discussions/666)
  • Resolves https://github.com/nuxt/framework/issues/648

❓ Type of change

  • [ ] 📖 Documentation (updates to the documentation or readme)
  • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality like performance)
  • [x] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Summary

This PR adds support for:

  1. rendering individual components through a special GET request to /__nuxt_render (implementing RFC https://github.com/nuxt/framework/discussions/666)
  2. registering and rendering server components with .server.vue suffix (implementing https://github.com/nuxt/framework/issues/648), including injecting scripts + styles from this render back into client-side DOM. As part of this, we only build CSS from server-components into client build (which is required), meaning the code from server-components won't be present in your client bundle.

CleanShot 2022-07-01 at 11 10 13

Next steps

  • [ ] The key next step is to review to see if we want to make any changes to RFC or spec.
  • [ ] Update documentation with details about server (+ client) components

Future improvement ideas

  1. 'Batching' server component updates
  2. Detect 'dependencies' of server components so entire state doesn't need to be pushed
  3. Detect 'effects' of server components so entire state doesn't need to be returned from renderer
  4. Move server-only component CSS out of manifest (but this can also be handled as part of solution to https://github.com/nuxt/framework/issues/4475)

📝 Checklist

  • [x] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

danielroe avatar Jul 01 '22 10:07 danielroe

Deploy Preview for nuxt3-docs canceled.

Name Link
Latest commit 345e9c40946f3b49fdac66854c3021c3f1bd43f0
Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62bed304f120080008b6c557

netlify[bot] avatar Jul 01 '22 10:07 netlify[bot]

Happy to review when not in draft anymore (cannot wait BTW!)

atinux avatar Oct 08 '22 12:10 atinux

:+1: This is waiting for merge of https://github.com/nuxt/framework/pull/5689.

danielroe avatar Oct 08 '22 12:10 danielroe

Will this be included in rc14?

cumhuronat avatar Nov 15 '22 07:11 cumhuronat

This is waiting on https://github.com/nuxt/framework/pull/5689.

danielroe avatar Nov 15 '22 09:11 danielroe

This is waiting on nuxt/framework#5689.

not anymore :)

cumhuronat avatar Nov 24 '22 18:11 cumhuronat

any progress ?

Dante-dan avatar Jan 03 '23 08:01 Dante-dan

So this is coming in 3.1? When should we expect to be able to start trying this out?

joezimjs avatar Jan 24 '23 03:01 joezimjs

3.1 will be coming imminently. 👀

But you can always try things out in the edge channel, and in fact we really appreciate people testing the edge to catch regressions early.

danielroe avatar Jan 24 '23 07:01 danielroe