@@ -19,7 +19,6 @@ import { ErrorCodes, callWithAsyncErrorHandling } from '../errorHandling'
19
19
import { PatchFlags , ShapeFlags , isArray } from '@vue/shared'
20
20
import { onBeforeUnmount , onMounted } from '../apiLifecycle'
21
21
import type { RendererElement } from '../renderer'
22
- import type { RawSlots , Slot } from '../componentSlots'
23
22
24
23
type Hook < T = ( ) => void > = T | T [ ]
25
24
@@ -460,16 +459,24 @@ function emptyPlaceholder(vnode: VNode): VNode | undefined {
460
459
}
461
460
462
461
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
473
480
}
474
481
475
482
export function setTransitionHooks ( vnode : VNode , hooks : TransitionHooks ) {
0 commit comments