]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(ssr): hydration `__vnode` missing for devtools (#9328)
authorAnthony Fu <anthonyfu117@hotmail.com>
Fri, 10 Nov 2023 07:27:16 +0000 (08:27 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Nov 2023 07:27:16 +0000 (15:27 +0800)
packages/runtime-core/src/hydration.ts

index 516823c70c56ee29528ae24789a8f9228dd488b2..01447503b5a9e66b50a686acbf87c6f486825a96 100644 (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