fix(ssr): hydration `__vnode` missing for devtools (#9328)

This commit is contained in:
Anthony Fu 2023-11-10 08:27:16 +01:00 committed by GitHub
parent e15dc05655
commit 5156ac5b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -111,6 +111,21 @@ export function createHydrationFunctions(
let domType = node.nodeType
vnode.el = node
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
if (!('__vnode' in node)) {
Object.defineProperty(node, '__vnode', {
value: vnode,
enumerable: false
})
}
if (!('__vueParentComponent' in node)) {
Object.defineProperty(node, '__vueParentComponent', {
value: parentComponent,
enumerable: false
})
}
}
if (patchFlag === PatchFlags.BAIL) {
optimized = false
vnode.dynamicChildren = null