From 5156ac5b38cfa80d3db26f2c9bf40cb22a7521cb Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 10 Nov 2023 08:27:16 +0100 Subject: [PATCH] fix(ssr): hydration `__vnode` missing for devtools (#9328) --- packages/runtime-core/src/hydration.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 516823c70..01447503b 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -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