Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions packages/runtime-core/src/components/BaseTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ const BaseTransitionImpl: ComponentOptions = {
setTransitionHooks(innerChild, enterHooks)
}

const oldChild = instance.subTree
const oldInnerChild = oldChild && getInnerChild(oldChild)
let oldInnerChild = instance.subTree && getInnerChild(instance.subTree)

// handle mode
if (
Expand All @@ -208,7 +207,7 @@ const BaseTransitionImpl: ComponentOptions = {
!isSameVNodeType(innerChild, oldInnerChild) &&
recursiveGetSubtree(instance).type !== Comment
) {
const leavingHooks = resolveTransitionHooks(
let leavingHooks = resolveTransitionHooks(
oldInnerChild,
rawProps,
state,
Expand All @@ -228,6 +227,7 @@ const BaseTransitionImpl: ComponentOptions = {
instance.update()
}
delete leavingHooks.afterLeave
oldInnerChild = undefined
}
return emptyPlaceholder(child)
} else if (mode === 'in-out' && innerChild.type !== Comment) {
Expand All @@ -238,18 +238,27 @@ const BaseTransitionImpl: ComponentOptions = {
) => {
const leavingVNodesCache = getLeavingNodesForType(
state,
oldInnerChild,
oldInnerChild!,
)
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild
leavingVNodesCache[String(oldInnerChild!.key)] = oldInnerChild!
// early removal callback
el[leaveCbKey] = () => {
earlyRemove()
el[leaveCbKey] = undefined
delete enterHooks.delayedLeave
oldInnerChild = undefined
}
enterHooks.delayedLeave = () => {
delayedLeave()
delete enterHooks.delayedLeave
oldInnerChild = undefined
}
enterHooks.delayedLeave = delayedLeave
}
} else {
oldInnerChild = undefined
}
} else if (oldInnerChild) {
oldInnerChild = undefined
}

return child
Expand Down
Loading