diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index 3d76113b0ff..18105efa5ab 100644 --- a/packages/runtime-core/src/components/KeepAlive.ts +++ b/packages/runtime-core/src/components/KeepAlive.ts @@ -283,7 +283,7 @@ function registerKeepAliveHook( if (target) { let current = target.parent while (current && current.parent) { - if (current.parent.type === KeepAliveImpl) { + if (isKeepAlive(current.parent.vnode)) { injectToKeepAliveRoot(wrappedHook, type, target, current) } current = current.parent