From 934f26f7d8af5910c87618f3ae2f2755acd71100 Mon Sep 17 00:00:00 2001 From: Thorsten Luenborg Date: Thu, 19 Jan 2023 21:00:53 +0100 Subject: [PATCH] fix(devtools): allow devtools to identify parent components of hydrated elements. --- packages/runtime-core/src/hydration.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 2170a9192c..2d63fbb1f5 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -354,6 +354,16 @@ export function createHydrationFunctions( ) } } + if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) { + Object.defineProperty(el, '__vnode', { + value: vnode, + enumerable: false + }) + Object.defineProperty(el, '__vueParentComponent', { + value: parentComponent, + enumerable: false + }) + } // vnode / directive hooks let vnodeHooks: VNodeHook | null | undefined if ((vnodeHooks = props && props.onVnodeBeforeMount)) { -- 2.39.5