Repository navigation
fix(nuxt): safe-guard extraPageMetaExtractionKeys - #32510
Conversation
|
|
WalkthroughThe changes update the handling of the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
extraPageMetaExtractionKeysextraPageMetaExtractionKeys
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #32510 will not alter performanceComparing Summary
|
| const extraPageMetaExtractionKeys = nuxt.options.experimental.extraPageMetaExtractionKeys | ||
| const extractedKeys = [ | ||
| ...defaultExtractionKeys, | ||
| 'middleware', |
There was a problem hiding this comment.
emmm.. middleware is also in defaultExtractionKeys, does it need to remove this line?
There was a problem hiding this comment.
True, does it make sense to use defaultExtractionKeys here as well?
It only contains 'middleware'
https://github.com/nuxt/nuxt/pull/32510/files#diff-c2594c96f1f7e8279fb8940560db036a9efa49e39522509ee02193dbac213092R77
There was a problem hiding this comment.
Does it seem that it maybe could also be deleted? But it doesn't matter with this.
nuxt/packages/nuxt/src/pages/utils.ts
Line 241 in d39f540
|
This is a nice check, but also highlights an issue with the wrong version of I have plans to fix/improve that (but for a start, |
| const augmentCtx = { | ||
| extraExtractionKeys: new Set(['middleware', ...nuxt.options.experimental.extraPageMetaExtractionKeys]), | ||
| extraExtractionKeys: new Set([ | ||
| 'middleware', |
There was a problem hiding this comment.
@danielroe maybe you know if defaultExtractionKeys can be used here instead of just adding 'middleware'? Came up here.
There was a problem hiding this comment.
No, it can't - we treat them slightly separately in terms of whether we remove them from the route metadata that's accessible at runtime from route.meta.
|
|
||
| // Extract macros from pages | ||
| const extractedKeys = [...defaultExtractionKeys, 'middleware', ...nuxt.options.experimental.extraPageMetaExtractionKeys] | ||
| const extraPageMetaExtractionKeys = nuxt.options?.experimental?.extraPageMetaExtractionKeys |
There was a problem hiding this comment.
I think we could probably just do:
| const extraPageMetaExtractionKeys = nuxt.options?.experimental?.extraPageMetaExtractionKeys | |
| const extraPageMetaExtractionKeys = nuxt.options?.experimental?.extraPageMetaExtractionKeys || [] |
... as the issue is presumably that it's not defined, rather than set to a string or something like that
|
thank you ❤️ |
🔗 Linked issue
This issue came up while checking the canary tests in Sentry Nuxt: getsentry/sentry-javascript#16762
Building the application resulted in this error:
nuxt.options.experimental.extraPageMetaExtractionKeys is not iterable📚 Description
This PR creates a safeguard (
Array.isArray()) before spreading the experimental value.