From 246ec5c594650f3fcccd0de94aa3f97b4d705e42 Mon Sep 17 00:00:00 2001 From: underfin <2218301630@qq.com> Date: Wed, 15 Jul 2020 21:24:16 +0800 Subject: [PATCH] fix(runtime-core): do not call transition enter hooks when mounting in suspense (#1588) fix #1583 --- packages/runtime-core/src/renderer.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index cbde56ac..8b2d4bc3 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -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) }