fix(runtime-core): should correctly call beforeEnter inside Suspense (#1805)

fix #1795
This commit is contained in:
underfin 2020-08-14 00:36:30 +08:00 committed by GitHub
parent 3991ff03ce
commit bc6f252c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -752,19 +752,17 @@ function baseCreateRenderer(
if (treeOwnerId && treeOwnerId !== scopeId) {
hostSetScopeId(el, treeOwnerId + '-s')
}
if (transition && !transition.persisted) {
transition.beforeEnter(el)
}
}
hostInsert(el, container, anchor)
// #1583 For inside suspense + suspense not resolved case, enter hook should call when suspense resolved
// #1689 For inside suspense + suspense resolved case, just call it
const needCallTransitionHooks =
(!parentSuspense || (parentSuspense && parentSuspense!.isResolved)) &&
transition &&
!transition.persisted
if (needCallTransitionHooks) {
transition!.beforeEnter(el)
}
hostInsert(el, container, anchor)
if (
(vnodeHook = props && props.onVnodeMounted) ||
needCallTransitionHooks ||