Skip to content

Commit fbb4f1a

Browse files
committed
chore: update
1 parent a09e006 commit fbb4f1a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/runtime-vapor/src/components/KeepAlive.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,14 @@ export const VaporKeepAliveImpl: ObjectVaporComponent = defineVaporComponent({
225225
})
226226

227227
let children = slots.default()
228-
if (isArray(children) && children.length > 1) {
229-
if (__DEV__) {
230-
warn(`KeepAlive should contain exactly one component child.`)
228+
if (isArray(children)) {
229+
children = children.filter(child => !(child instanceof Comment))
230+
if (children.length > 1) {
231+
if (__DEV__) {
232+
warn(`KeepAlive should contain exactly one component child.`)
233+
}
234+
return children
231235
}
232-
return children
233236
}
234237

235238
// inject hooks to DynamicFragment to cache components during updates

0 commit comments

Comments
 (0)