Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(nuxt): server-only components - #5688

Closed
danielroe wants to merge 9 commits into
mainfrom
feat/server-components
Closed

feat(nuxt): server-only components#5688
danielroe wants to merge 9 commits into
mainfrom
feat/server-components

Conversation

@danielroe

@danielroedanielroe commented Jul 1, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ 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)
  • ✨ 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 Server only components nuxt#11856), 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 Nuxt 3 prefetch all assets from every pages and every layouts. nuxt#13778)

📝 Checklist

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

@danielroedanielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Jul 1, 2022
@danielroe
danielroe requested review from antfu, atinux and pi0July 1, 2022 10:20
@danielroedanielroe self-assigned this Jul 1, 2022
@netlify

netlifyBot commented Jul 1, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit345e9c4
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62bed304f120080008b6c557

@pi0
pi0 marked this pull request as draft July 1, 2022 10:34
@danielroe
danielroeforce-pushed the feat/server-components branch from ddb365e to ff79f3fCompareJuly 1, 2022 10:49
@atinux

Copy link
Copy Markdown
Member

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

@danielroe

Copy link
Copy Markdown
MemberAuthor

👍 This is waiting for merge of #5689.

@cumhuronat

Copy link
Copy Markdown

Will this be included in rc14?

@danielroe

Copy link
Copy Markdown
MemberAuthor

This is waiting on #5689.

@cumhuronat

Copy link
Copy Markdown

This is waiting on #5689.

not anymore :)

@Dante-dan

This comment was marked as duplicate.

@danielroedanielroe mentioned this pull request Jan 6, 2023
7 tasks
@danielroe
danielroe deleted the feat/server-components branch January 9, 2023 11:29
@joezimjs

Copy link
Copy Markdown

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

@danielroe

Copy link
Copy Markdown
MemberAuthor

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.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xenhancementNew feature or request🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server only components

6 participants

@danielroe@atinux@cumhuronat@Dante-dan@joezimjs@josueayala27