From d36f2f3b07ca4520108cbff5d26f11b922c6a7b2 Mon Sep 17 00:00:00 2001 From: edison1105 Date: Sun, 22 Oct 2023 11:10:33 +0800 Subject: [PATCH] chore: improve code chore: improve code chore: improve code chore: improve code chore: improve code --- packages/runtime-core/src/hydration.ts | 20 +++++++++----------- packages/runtime-core/src/renderer.ts | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 58abc7a7b7b..ec28e7d4a89 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -15,7 +15,7 @@ import { ComponentInternalInstance } from './component' import { invokeDirectiveHook } from './directives' import { warn } from './warning' import { PatchFlags, ShapeFlags, isReservedProp, isOn } from '@vue/shared' -import { RendererInternals } from './renderer' +import { needTransition, RendererInternals } from './renderer' import { setRef } from './rendererTemplateRef' import { SuspenseImpl, @@ -374,22 +374,20 @@ export function createHydrationFunctions( let needCallTransitionHooks = false if (isTemplateNode(el)) { needCallTransitionHooks = - (!parentSuspense || - (parentSuspense && !parentSuspense.pendingBranch)) && - transition && - !transition.persisted && - parentComponent?.vnode.props?.appear + needTransition(parentSuspense, transition) && + parentComponent && + parentComponent.vnode.props && + parentComponent.vnode.props.appear const content = (el as HTMLTemplateElement).content .firstChild as Element needCallTransitionHooks && transition!.beforeEnter(content) - vnode.el = content - dirs && invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount') - // replace