-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix(nuxt): return non-existent route component in RouteProvider #32266
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the RouteProvider
component to immediately return when the passed vnode
prop is undefined, preventing unclear warnings in nested child pages that don't exist.
- Made the
vnode
prop optional instead of required. - Added an early return guard for
!props.vnode
. - Ensures undefined vnodes are returned directly to avoid long warnings.
Comments suppressed due to low confidence (2)
packages/nuxt/src/app/components/route-provider.ts:47
- There's no test covering the new branch where
props.vnode
is undefined. Consider adding a unit test to verify that the component returns without warning whenvnode
is missing.
if (!props.vnode) {
packages/nuxt/src/app/components/route-provider.ts:47
- [nitpick] Returning
props.vnode
(undefined) from a render function could lead to ambiguous behavior. It may be clearer to returnnull
or an explicit empty comment node to signal an intentional no-op render.
if (!props.vnode) {
route: { | ||
type: Object as () => RouteLocationNormalizedLoaded, | ||
required: true, | ||
}, | ||
vnode: Object as () => VNode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vnode
prop is now optional but its definition lacks clarity. Consider using PropType<VNode | undefined>
with an explicit required: false
or default value to clearly communicate its optional nature.
Copilot uses AI. Check for mistakes.
WalkthroughThe changes modify the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (2)
✨ Finishing Touches
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 (
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #32266 will not alter performanceComparing Summary
|
🔗 Linked issue
📚 Description
when rendering a nested child page that doesn't exist an undefined vnode might be passed to
<RouteProvider>
, leading to a long and unclear warning in the terminal. This directly returns the vnode in this case.