Skip to content

Commit ced1ed4

Browse files
committed
fix(Transition): fix transition memory leak edge case
1 parent 2442c3b commit ced1ed4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const BaseTransitionImpl: ComponentOptions = {
199199
}
200200

201201
const oldChild = instance.subTree
202-
const oldInnerChild = oldChild && getInnerChild(oldChild)
202+
let oldInnerChild = oldChild && getInnerChild(oldChild)
203203

204204
// handle mode
205205
if (
@@ -238,9 +238,9 @@ const BaseTransitionImpl: ComponentOptions = {
238238
) => {
239239
const leavingVNodesCache = getLeavingNodesForType(
240240
state,
241-
oldInnerChild,
241+
oldInnerChild!,
242242
)
243-
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild
243+
leavingVNodesCache[String(oldInnerChild!.key)] = oldInnerChild!
244244
// early removal callback
245245
el[leaveCbKey] = () => {
246246
earlyRemove()
@@ -250,6 +250,8 @@ const BaseTransitionImpl: ComponentOptions = {
250250
enterHooks.delayedLeave = delayedLeave
251251
}
252252
}
253+
} else if (oldInnerChild) {
254+
oldInnerChild = undefined
253255
}
254256

255257
return child

0 commit comments

Comments
 (0)