Skip to content

Commit

Permalink
chore: minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 14, 2025
1 parent b678411 commit 6daa180
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/runtime-core/src/components/Teleport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,18 @@ export const TeleportImpl = {
target,
props,
} = vnode

if (target) {
hostRemove(targetStart!)
hostRemove(targetAnchor!)
}

// an unmounted teleport should always unmount its children whether it's disabled or not
doRemove && hostRemove(anchor!)

// skip unmount if not disabled & target missing (children not rendered)
const disabled = isTeleportDisabled(props)
if (!disabled && !target) return

if (target) {
hostRemove(targetStart!)
hostRemove(targetAnchor!)
}

if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
const shouldRemove = doRemove || !disabled
for (let i = 0; i < (children as VNode[]).length; i++) {
Expand Down

0 comments on commit 6daa180

Please sign in to comment.