fix(runtime-core): component mount anchor memory leak (#2459)

fix #2458
This commit is contained in:
Bas van Meurs 2020-12-05 00:03:10 +01:00 committed by GitHub
parent 82bf7ebf36
commit 3867bb4c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1395,8 +1395,9 @@ function baseCreateRenderer(
} }
// onVnodeMounted // onVnodeMounted
if ((vnodeHook = props && props.onVnodeMounted)) { if ((vnodeHook = props && props.onVnodeMounted)) {
const scopedInitialVNode = initialVNode
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
invokeVNodeHook(vnodeHook!, parent, initialVNode) invokeVNodeHook(vnodeHook!, parent, scopedInitialVNode)
}, parentSuspense) }, parentSuspense)
} }
// activated hook for keep-alive roots. // activated hook for keep-alive roots.
@ -1410,6 +1411,9 @@ function baseCreateRenderer(
queuePostRenderEffect(a, parentSuspense) queuePostRenderEffect(a, parentSuspense)
} }
instance.isMounted = true instance.isMounted = true
// #2458: deference mount-only object parameters to prevent memleaks
initialVNode = container = anchor = null as any
} else { } else {
// updateComponent // updateComponent
// This is triggered by mutation of component's own state (next: null) // This is triggered by mutation of component's own state (next: null)