From fe05b546d763b708d5dd9b34cd9930b9ff6c9328 Mon Sep 17 00:00:00 2001 From: daiwei Date: Fri, 15 Dec 2023 09:15:55 +0800 Subject: [PATCH 1/3] fix(hydration): handle appear transition before patch props --- packages/runtime-core/src/hydration.ts | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 94d6e8f6277..9a78c3900b5 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -344,6 +344,29 @@ export function createHydrationFunctions( if (dirs) { invokeDirectiveHook(vnode, null, parentComponent, 'created') } + + // handle appear transition + // this should be before patch props because el will be replaced + let needCallTransitionHooks = false + if (isTemplateNode(el)) { + needCallTransitionHooks = + needTransition(parentSuspense, transition) && + parentComponent && + parentComponent.vnode.props && + parentComponent.vnode.props.appear + + const content = (el as HTMLTemplateElement).content + .firstChild as Element + + if (needCallTransitionHooks) { + transition!.beforeEnter(content) + } + + // replace