-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(nuxt): support server components with extracted payloads #10113
Conversation
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
This is a good idea to use asyncData to enable payload extraction but on the other hand, we would be unable to implement and support hybrid islands (with remote sources) in static websites. As far as I know, we currently use dynamic |
Nice thought! Created an issue so we can track: nuxt/nuxt#12343. I'll push a fix to this PR so we support both payload extraction and runtime fetching when props are changed. |
Thanks for creating tracker however i'm still wondering what is the issue we are trying to solve. Island responses are extracted but not in the same payload file and network requests should be cached. Putting their response into one payload, would duplicate them across pages while currently we download a unique island+props in one request. |
The issue is the waterfall - they aren't fetched until the page starts being loaded, at which point the delay the transition, whereas if they are in the payload then they can be prefetched ahead of time and the page transition is instant. Moreover, I don't believe they are extracted into separate files at all when generating at the moment - happy to look into it π€ |
This is by design for islands, in general, to be individually loaded assets (like images). However, they are expected to be pre-rendered if not it is probably a bug. I guess we can have a separate implementation |
Pushed a couple of improvements (and fixed the bug of not emitting island output during prerender) and updated the issue description. Let me know what you think π |
Thanks for the updates. However still, in full static mode with payload extraction, when two pages use the same islands/props, duplicate data would be downloaded (and prefetched) in the payload of each page. Copy Is it possible that we enable |
π Linked issue
β Type of change
π Description
This builds on #9972 to support server components in fully static websites. It does two things:
~/.output/public/__nuxt_island/PureComponent:6LYrSuODRS
. This means that server components aren't necessarily tied to the page in which they are used.There is scope for improving this, for example, it's not necessarily to include the HTML in the payload if we could prefetch it. But I don't think this PR binds us to that - it's just an implementation detail at the moment and I would suggest we switch to fully extracted server components once we have a way of prefetching them - maybe through something like #7805.
π Checklist