From 9fcf3360293ea9f32bdaaca5b6e93d09a5ea253c Mon Sep 17 00:00:00 2001 From: TalexDreamSoul <59305952+TalexDreamSoul@users.noreply.github.com> Date: Mon, 12 May 2025 16:38:19 +0000 Subject: [PATCH] fix(runtime-core): add skip onmount optimization prop on BaseTransition component --- packages/runtime-core/src/components/BaseTransition.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/components/BaseTransition.ts b/packages/runtime-core/src/components/BaseTransition.ts index 2b58bc3fc43..69b7bca411b 100644 --- a/packages/runtime-core/src/components/BaseTransition.ts +++ b/packages/runtime-core/src/components/BaseTransition.ts @@ -55,6 +55,9 @@ export interface BaseTransitionProps { onAppear?: Hook<(el: HostElement, done: () => void) => void> onAfterAppear?: Hook<(el: HostElement) => void> onAppearCancelled?: Hook<(el: HostElement) => void> + + // Ignore unmount optimization to execute full animation + skipUnmountingOptimization?: boolean } export interface TransitionHooks { @@ -135,6 +138,8 @@ export const BaseTransitionPropsValidators: Record = { onAppear: TransitionHookValidator, onAfterAppear: TransitionHookValidator, onAppearCancelled: TransitionHookValidator, + + skipUnmountingOptimization: Boolean, } const recursiveGetSubtree = (instance: ComponentInternalInstance): VNode => { @@ -343,6 +348,7 @@ export function resolveTransitionHooks( onAppear, onAfterAppear, onAppearCancelled, + skipUnmountingOptimization = false, } = props const key = String(vnode.key) const leavingVNodesCache = getLeavingNodesForType(state, vnode) @@ -438,7 +444,7 @@ export function resolveTransitionHooks( if (el[enterCbKey]) { el[enterCbKey](true /* cancelled */) } - if (state.isUnmounting) { + if (state.isUnmounting && !skipUnmountingOptimization) { return remove() } callHook(onBeforeLeave, [el])