Skip to content

fix(hydration): handle v-if node mismatch #12801

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

edison1105
Copy link
Member

close #12782

Copy link

github-actions bot commented Feb 1, 2025

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+60 B) 38 kB (+32 B) 34.3 kB (+31 B)
vue.global.prod.js 158 kB (+60 B) 57.9 kB (+30 B) 51.5 kB (+59 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.2 kB 16.6 kB
createApp 54.3 kB 21.2 kB 19.3 kB
createSSRApp 58.6 kB (+60 B) 22.9 kB (+26 B) 20.9 kB (+22 B)
defineCustomElement 59.2 kB 22.8 kB 20.7 kB
overall 68.4 kB 26.3 kB 24 kB

Copy link

pkg-pr-new bot commented Feb 1, 2025

Open in Stackblitz

@vue/compiler-core

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

@vue/compiler-ssr

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: b2efba8

@edison1105 edison1105 added ready to merge The PR is ready to be merged. 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. scope:hydration labels Feb 1, 2025
Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this adds a new type of allowable mismatch. Is there any precedent for this type of mismatch?

If we want to allow this then we may need to consider similar cases, like:

Those seem essentially the same to me.

node: Node,
{ props }: VNode,
): boolean {
return isComment(node) && props != null && hasOwn(props, allowMismatchAttr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a node has data-allow-mismatch="class" then I wouldn't expect it to suppress hydration errors for unexpected comment nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready to merge The PR is ready to be merged. scope:hydration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data-allow-mismatch does not suppress mismatch caused by v-if
2 participants