Skip to content

Commit

Permalink
fix(runtime-core): component mount anchor memory leak (#2459)
Browse files Browse the repository at this point in the history
fix #2458
  • Loading branch information
basvanmeurs authored Dec 4, 2020
1 parent 82bf7eb commit 3867bb4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,9 @@ function baseCreateRenderer(
}
// onVnodeMounted
if ((vnodeHook = props && props.onVnodeMounted)) {
const scopedInitialVNode = initialVNode
queuePostRenderEffect(() => {
invokeVNodeHook(vnodeHook!, parent, initialVNode)
invokeVNodeHook(vnodeHook!, parent, scopedInitialVNode)
}, parentSuspense)
}
// activated hook for keep-alive roots.
Expand All @@ -1410,6 +1411,9 @@ function baseCreateRenderer(
queuePostRenderEffect(a, parentSuspense)
}
instance.isMounted = true

// #2458: deference mount-only object parameters to prevent memleaks
initialVNode = container = anchor = null as any
} else {
// updateComponent
// This is triggered by mutation of component's own state (next: null)
Expand Down

0 comments on commit 3867bb4

Please sign in to comment.