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
if ((vnodeHook = props && props.onVnodeMounted)) {
const scopedInitialVNode = initialVNode
queuePostRenderEffect(() => {
invokeVNodeHook(vnodeHook!, parent, initialVNode)
invokeVNodeHook(vnodeHook!, parent, scopedInitialVNode)
}, parentSuspense)
}
// activated hook for keep-alive roots.
@ -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)