Skip to content

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Aug 25, 2025

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

  • Bug Fixes
    • Improved reliability of hydration mismatch diagnostics for vShow. The directive now consistently reports its name across build modes, ensuring clearer and more consistent messages when mismatches occur, including in production builds when detailed hydration reporting is enabled. No changes to how vShow behaves at runtime; this update enhances debugging clarity without affecting existing functionality or APIs.

Copy link

coderabbitai bot commented Aug 25, 2025

Walkthrough

The vShow directive now declares a fixed public name property (name: 'show') in its exported object and type. The DEV-only conditional runtime assignment has been removed.

Changes

Cohort / File(s) Summary
Directive typing and initialization update
packages/runtime-dom/src/directives/vShow.ts
Made name: 'show' mandatory in the vShow export type and included it in the object literal; removed DEV/flag-guarded runtime assignment path for vShow.name.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Ensure Vue works without compile-time flags by removing dependency on VUE_PROD_HYDRATION_MISMATCH_DETAILS (#13805)
Prevent "VUE_PROD_HYDRATION_MISMATCH_DETAILS is not defined" error in runtime (#13805)

Assessment against linked issues: Out-of-scope changes

(none)

Possibly related PRs

Suggested labels

ready to merge, :hammer: p3-minor-bug, scope:hydration

Poem

A hop and a bop through DOM we go,
I pin my name: just “show,” not “maybe so.”
No flags to flap, no branches to sow—
Hydration’s calm, the warnings low.
Thump-thump! says the rabbit, green lights glow.

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edison/fix/13805

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB (+12 B) 38.4 kB (+9 B) 34.6 kB (+33 B)
vue.global.prod.js 159 kB (+12 B) 58.5 kB (+5 B) 52.1 kB (+31 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.5 kB 18.2 kB 16.7 kB
createApp 54.5 kB 21.2 kB 19.4 kB
createSSRApp 58.7 kB 22.9 kB 20.9 kB
defineCustomElement 59.5 kB 22.8 kB 20.8 kB
overall 68.5 kB 26.4 kB 24.1 kB

Copy link

pkg-pr-new bot commented Aug 25, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13806

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13806

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13806

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13806

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13806

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13806

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13806

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13806

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13806

vue

npm i https://pkg.pr.new/vue@13806

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13806

commit: 65452e9

@edison1105 edison1105 merged commit 1031e8d into main Aug 25, 2025
15 of 16 checks passed
@edison1105 edison1105 deleted the edison/fix/13805 branch August 25, 2025 06:52
Copy link

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 0f916d8 and 65452e9.

📒 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 runtime ReferenceError when those flags aren’t defined by the bundler and keeps hydration mismatch checks functional.


12-14: Add static name to all other directives

The script output confirms that only vShow has a runtime name field. Both vModel*.ts and vOn.ts exports lack a static name 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.ts

so 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 own name: '<directiveName>'.
• Confirm vOn similarly declares and assigns name: 'on'.

This ensures all directives carry a static name at runtime and avoids gated flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not defined SSR hydration mismatch warning/error with v-show + style attr
1 participant