Skip to content

Commit 3724693

Browse files
authored
fix(runtime-core): properly get keepAlive child (#10772)
close #10771
1 parent 958286e commit 3724693

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

+10-8
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,17 @@ function getKeepAliveChild(vnode: VNode): VNode | undefined {
470470

471471
const { shapeFlag, children } = vnode
472472

473-
if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
474-
return (children as VNodeArrayChildren)[0] as VNode
475-
}
473+
if (children) {
474+
if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
475+
return (children as VNodeArrayChildren)[0] as VNode
476+
}
476477

477-
if (
478-
shapeFlag & ShapeFlags.SLOTS_CHILDREN &&
479-
isFunction((children as any).default)
480-
) {
481-
return (children as any).default()
478+
if (
479+
shapeFlag & ShapeFlags.SLOTS_CHILDREN &&
480+
isFunction((children as any).default)
481+
) {
482+
return (children as any).default()
483+
}
482484
}
483485
}
484486

0 commit comments

Comments
 (0)