fix(nuxt): skip payload extraction for island context #20590
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
nuxt-modules/og-image#35
β Type of change
π Description
When prerendering a Nuxt app that uses Nuxt Islands components, the home page payload will be reset whenever an Island component is rendered.
The consequence of this for prerendered static Nuxt apps is that any data fetching required for the home page won't work, potentially breaking the page.
Reproduction
https://stackblitz.com/edit/nuxt-starter-iqevpt?file=pages/z.vue
nuxi generate
cat .output/public/_payload.js
(you'll seeexport default {data:{},prerenderedAt:1682833083825}
which is not correct)npx sirv-cli .output/public/
, you'll see the posts can't loadThe expected output for the payload is:
Issue / Solution
The issue seems to be related to the island context being given the
/
path and allowed to generate payloads. By ignoring payload extraction for island components we can get around this issue.An alternative solution may be to change the given path, but not sure if this will have unexpected consequences.
There may be a better solution than these two so please advise.
π Checklist