Skip to content

Commit 9ae6212

Browse files
author
RicardoErii
committed
fix: fix
1 parent 3624393 commit 9ae6212

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

packages/runtime-core/src/components/BaseTransition.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { ErrorCodes, callWithAsyncErrorHandling } from '../errorHandling'
1919
import { PatchFlags, ShapeFlags, isArray } from '@vue/shared'
2020
import { onBeforeUnmount, onMounted } from '../apiLifecycle'
2121
import type { RendererElement } from '../renderer'
22-
import type { RawSlots, Slot } from '../componentSlots'
2322

2423
type Hook<T = () => void> = T | T[]
2524

@@ -460,16 +459,24 @@ function emptyPlaceholder(vnode: VNode): VNode | undefined {
460459
}
461460

462461
function getKeepAliveChild(vnode: VNode): VNode | undefined {
463-
return isKeepAlive(vnode)
464-
? // #7121 ensure get the child component subtree in case
465-
// it's been replaced during HMR
466-
__DEV__ && vnode.component
467-
? vnode.component.subTree
468-
: vnode.children
469-
? ((vnode.children as VNodeArrayChildren)[0] as VNode) ||
470-
((vnode.children as RawSlots).default as Slot)?.()
471-
: undefined
472-
: vnode
462+
if (!isKeepAlive(vnode)) {
463+
return vnode
464+
}
465+
// #7121 ensure get the child component subtree in case
466+
// it's been replaced during HMR
467+
if (__DEV__ && vnode.component) {
468+
return vnode.component.subTree
469+
}
470+
471+
if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
472+
return (vnode.children as VNodeArrayChildren)?.[0] as VNode
473+
}
474+
475+
if (vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
476+
return (vnode.children as any)?.default?.()
477+
}
478+
479+
return undefined
473480
}
474481

475482
export function setTransitionHooks(vnode: VNode, hooks: TransitionHooks) {

0 commit comments

Comments
 (0)