-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
fix(ssr): fix hydration mismatch warning about mutiple continuous tex… #7301
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.
Looks good
6e75fb8
to
884900b
Compare
@zhangzhonghe Thanks for providing a fix for this problem. Do you know when it will be merged? |
when it merge? |
This fixes the problem for the initial hydration, but it throws an error if the text is subsequently updated: I think most real use cases will need support for updates. |
const nextNode = nextSibling(node) | ||
// because the node's text has been inserted to the container, | ||
// so we need to remove it | ||
remove(node) |
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.
There's an error thrown by the mutation of the component's own state that spawns at renderer.ts
line 1494 and it bubbles up until reaching the remove()
function
Maybe that remove()
function is trying to access the parentNode
from the removed node here?
The error stack:
vue.runtime.esm-browser.js:9092 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')
at remove (vue.runtime.esm-browser.js:9092:26)
at performRemove (vue.runtime.esm-browser.js:7636:7)
at remove (vue.runtime.esm-browser.js:7650:7)
at unmount (vue.runtime.esm-browser.js:7605:9)
at patchKeyedChildren (vue.runtime.esm-browser.js:7402:9)
at patchChildren (vue.runtime.esm-browser.js:7258:11)
at patchElement (vue.runtime.esm-browser.js:6722:7)
at processElement (vue.runtime.esm-browser.js:6557:7)
at patch (vue.runtime.esm-browser.js:6418:11)
at ReactiveEffect.componentUpdateFn [as fn] (vue.runtime.esm-browser.js:7152:9)
…t vnodes (#7285)
fix #7285
The following
Comp
will be rendered as a"<div>foo</div>"
on the ssr side.The
"<div>foo</div>"
will be rendered as a div element with a single child text node in the browser, but the aboveComp
will be rendered byVue
as a div element with two child vnodes, so will cause a mismatch warning during hydration.