Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(nuxt): use prerendered islands to serialise/revive payload #21461

Merged
merged 23 commits into from Jun 14, 2023

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Jun 8, 2023

πŸ”— Linked issue

#19772

❓ 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR aims to move server component HTML out of the payload and to use the separate (prerendered) island instead. No download is required for hydrating HTML. This should significantly decrease size of HTML (as it won't be located in page twice) and make using server components much more compelling for large layout elements.

We can now also remove the almost duplicate implementations of NuxtServerComponent and NuxtIsland which originally diverged to allow static generation prefetching with payloads.

Note: I would expect we can now refactor packages/nuxt/src/components/runtime/server-component.ts to a much more minimal implementation.

I did unearth an issue with slots in server components which I will investigate shortly but I do not believe it is not a regression introduced by this PR. edit: it was

πŸ“ Checklist

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

@danielroe danielroe self-assigned this Jun 8, 2023
@danielroe danielroe changed the title refactor: reorder code to make parallel clearer perf(nuxt): use prerendered islands to serialise/revive payload Jun 8, 2023
@huang-julien
Copy link
Member

huang-julien commented Jun 8, 2023

There's indeed an issue with slots This issue doesn't comes from this PR.

We can have multiple nodes when querying document.querySelectorAll('[nuxt-ssr-component-uid="2"]') on /islands. But the current implementation requires all nuxt-ssr-component-uid to be unique so it can target the correct DOM node to teleport the slot

image

I'll fix this probably in the incoming weekend

@danielroe
Copy link
Member Author

/trigger release

@github-actions
Copy link
Contributor

πŸš€ Release triggered! You can now install nuxt@npm:nuxt3@pr-21461

@danielroe danielroe marked this pull request as ready for review June 11, 2023 00:00
@danielroe danielroe merged commit 19fc282 into main Jun 14, 2023
22 checks passed
@danielroe danielroe deleted the perf/skip-server-component-html branch June 14, 2023 09:09
@github-actions github-actions bot mentioned this pull request Jun 14, 2023
s1mpLyy

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants