-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix(nuxt): use comment instead of <div> as placeholder before client component is mounted
#33466
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
base: main
Are you sure you want to change the base?
Conversation
…onent is mounted
|
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
WalkthroughReplaces visible placeholder DOM nodes (div) with Vue comment VNodes across multiple Nuxt runtime components. server-placeholder.ts now returns createCommentVNode('placeholder') instead of a div. client-component.ts and client-only.ts replace various fallback and template render paths that previously used Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🔇 Additional comments (4)
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. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/nuxt/src/app/components/server-placeholder.ts(1 hunks)packages/nuxt/src/components/runtime/client-component.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
packages/nuxt/src/app/components/server-placeholder.tspackages/nuxt/src/components/runtime/client-component.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: code
🔇 Additional comments (6)
packages/nuxt/src/app/components/server-placeholder.ts (1)
1-1: LGTM: Import addition is correct.The import of
createCommentVNodeis appropriate for the new implementation.packages/nuxt/src/components/runtime/client-component.ts (5)
1-1: LGTM: Import addition is correct.Adding
createCommentVNodeto the imports from 'vue' is necessary for the new placeholder implementation.
35-37: LGTM: Non-script-setup render override correctly uses comment node.The fallback for the non-script-setup render override now uses a comment node placeholder, which prevents Vue's runtime from confusing it with the actual component root when they share the same tag name.
40-43: LGTM: Template syntax correctly uses HTML comment for placeholder.The runtime-compiler template fallback correctly uses the HTML comment syntax
<!--placeholder-->, which will be compiled by Vue's template compiler into the equivalent ofcreateCommentVNode('placeholder').
59-66: LGTM: Async setup fallback correctly uses comment node.The fallback for asynchronous setup functions now returns a comment node placeholder, maintaining consistency with the other changes in this file.
68-72: LGTM: Synchronous setup fallback correctly uses comment node.The fallback for synchronous setup functions that return render functions now uses a comment node placeholder, completing the consistent replacement of all placeholder divs in this file.
CodSpeed Performance ReportMerging #33466 will not alter performanceComparing Summary
|
|
it looks like we are now getting: |
|
Should we change the expected behavior of this test entry? Lines 142 to 143 in 3c38d1f
|
|
maybe we can specify the fallback element (and also verify that the attribute is applied correctly when hydrated?) |
|
It seems like there are a lot of test cases that need to be adjusted. |
🔗 Linked issue
fix #33268
📚 Description
When rendering a client component, if the placeholder node and the actual root node are elements that has the same tag name, vue runtime will not run the
setScopeIdagain, while thescopeIdis also not checked during hydration.I'm not sure whether there is any reason that the placeholder is required to be an element.