-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
fix(runtime-dom): add name to vShow for prop mismatch check #13806
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
WalkthroughThe vShow directive now declares a fixed public name property ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(none) Possibly related PRs
Suggested labels
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
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: 0
🧹 Nitpick comments (1)
packages/runtime-dom/src/directives/vShow.ts (1)
12-14
: Add a small regression test to lock this in.A unit test that asserts
vShow.name === 'show'
would prevent future regressions and catches accidental removal during refactors. If there’s an existing hydration-mismatch details test, also assert that the mismatch reporter reads the directive name without depending on compile-time flags.If helpful, I can draft a minimal test case once you confirm the preferred test location for runtime-dom directive tests in this repo.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/runtime-dom/src/directives/vShow.ts
(1 hunks)
⏰ 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). (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (2)
packages/runtime-dom/src/directives/vShow.ts (2)
12-14
: Solid fix: statically setting vShow.name removes runtime-flag dependency (resolves #13805).Defining
name: 'show'
in the object literal and tightening the type to require it eliminates the previous reference to compile-time flags during evaluation. This prevents runtimeReferenceError
when those flags aren’t defined by the bundler and keeps hydration mismatch checks functional.
12-14
: Add staticname
to all other directivesThe script output confirms that only
vShow
has a runtimename
field. BothvModel*.ts
andvOn.ts
exports lack a staticname
property, which risks the same hydration-mismatch errors in consumer builds that omit the flags. Please update each directive export in• packages/runtime-dom/src/directives/vModel.ts
• packages/runtime-dom/src/directives/vOn.tsso that their signatures and object literals include a hard‐coded
name
:For example, in vModel.ts:
-export const vModelText: ModelDirective<HTMLInputElement|HTMLTextAreaElement> = { +export const vModelText: ModelDirective<HTMLInputElement|HTMLTextAreaElement> & { name: 'modelText' } = { + name: 'modelText', created(el, { modifiers }, vnode) { … }, mounted(el, { value }) { … }, beforeUpdate(el, { value, modifiers }, vnode) { … } }And in vOn.ts:
-export const vOn: ObjectDirective<EventTarget> = { +export const vOn: ObjectDirective<EventTarget> & { name: 'on' } = { + name: 'on', beforeMount(el, { value, modifiers }) { … }, mounted(el, { value, modifiers }) { … }, updated(el, { value, modifiers }) { … }, // … }• Verify each
vModel*
(vModelText, vModelCheckbox, vModelRadio, vModelSelect, vModelDynamic) has its ownname: '<directiveName>'
.
• ConfirmvOn
similarly declares and assignsname: 'on'
.This ensures all directives carry a static
name
at runtime and avoids gated flags.
close #13805
re-fix #13744
revert #13777
The implementation in #13777 requires users to configure
__FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__
, otherwise errors like #13805 will occur.Summary by CodeRabbit