From 9acce54322e8ef423874c03c65ff438dc41d385f Mon Sep 17 00:00:00 2001 From: edison1105 Date: Tue, 24 Oct 2023 21:48:34 +0800 Subject: [PATCH] chore: improve code --- packages/runtime-dom/src/components/TransitionGroup.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/runtime-dom/src/components/TransitionGroup.ts b/packages/runtime-dom/src/components/TransitionGroup.ts index 2a2d0f16ee4..4709c56ee55 100644 --- a/packages/runtime-dom/src/components/TransitionGroup.ts +++ b/packages/runtime-dom/src/components/TransitionGroup.ts @@ -113,7 +113,8 @@ const TransitionGroupImpl: ComponentOptions = { tag = 'span' } - prevChildren = children + prevChildren = + children && children.filter(child => !isComment(child.el as Element)) children = slots.default ? getTransitionRawChildren(slots.default()) : [] for (let i = 0; i < children.length; i++) { @@ -129,9 +130,6 @@ const TransitionGroupImpl: ComponentOptions = { } if (prevChildren) { - prevChildren = prevChildren.filter( - child => !isComment(child.el as Element) - ) for (let i = 0; i < prevChildren.length; i++) { const child = prevChildren[i] setTransitionHooks(