fix(runtime-core): do not call transition enter hooks when mounting in suspense (#1588)

fix #1583
This commit is contained in:
underfin 2020-07-15 21:24:16 +08:00 committed by GitHub
parent 64c7b2f9ce
commit 246ec5c594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -736,14 +736,17 @@ function baseCreateRenderer(
}
hostInsert(el, container, anchor)
// #1583 For inside suspense case, enter hook should call when suspense resolved
const needCallTransitionHooks =
!parentSuspense && transition && !transition.persisted
if (
(vnodeHook = props && props.onVnodeMounted) ||
(transition && !transition.persisted) ||
needCallTransitionHooks ||
dirs
) {
queuePostRenderEffect(() => {
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode)
transition && !transition.persisted && transition.enter(el)
needCallTransitionHooks && transition!.enter(el)
dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted')
}, parentSuspense)
}