Skip to content

Commit 9fcf336

Browse files
fix(runtime-core): add skip onmount optimization prop on BaseTransition component
1 parent 3cb4db2 commit 9fcf336

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/runtime-core/src/components/BaseTransition.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export interface BaseTransitionProps<HostElement = RendererElement> {
5555
onAppear?: Hook<(el: HostElement, done: () => void) => void>
5656
onAfterAppear?: Hook<(el: HostElement) => void>
5757
onAppearCancelled?: Hook<(el: HostElement) => void>
58+
59+
// Ignore unmount optimization to execute full animation
60+
skipUnmountingOptimization?: boolean
5861
}
5962

6063
export interface TransitionHooks<HostElement = RendererElement> {
@@ -135,6 +138,8 @@ export const BaseTransitionPropsValidators: Record<string, any> = {
135138
onAppear: TransitionHookValidator,
136139
onAfterAppear: TransitionHookValidator,
137140
onAppearCancelled: TransitionHookValidator,
141+
142+
skipUnmountingOptimization: Boolean,
138143
}
139144

140145
const recursiveGetSubtree = (instance: ComponentInternalInstance): VNode => {
@@ -343,6 +348,7 @@ export function resolveTransitionHooks(
343348
onAppear,
344349
onAfterAppear,
345350
onAppearCancelled,
351+
skipUnmountingOptimization = false,
346352
} = props
347353
const key = String(vnode.key)
348354
const leavingVNodesCache = getLeavingNodesForType(state, vnode)
@@ -438,7 +444,7 @@ export function resolveTransitionHooks(
438444
if (el[enterCbKey]) {
439445
el[enterCbKey](true /* cancelled */)
440446
}
441-
if (state.isUnmounting) {
447+
if (state.isUnmounting && !skipUnmountingOptimization) {
442448
return remove()
443449
}
444450
callHook(onBeforeLeave, [el])

0 commit comments

Comments
 (0)