@@ -41,14 +41,17 @@ export const vaporTransitionImpl: VaporTransitionInterface = {
4141 const { mode } = props
4242 // TODO check mode
4343
44- child . applyLeavingHooks = ( block : Block , afterLeaveCb : ( ) => void ) => {
44+ child . applyLeavingHooks = (
45+ leavingBlock : Block ,
46+ afterLeaveCb : ( ) => void ,
47+ ) => {
4548 let leavingHooks = resolveTransitionHooks (
46- block as any ,
49+ leavingBlock as any ,
4750 props ,
4851 state ,
4952 currentInstance ! ,
5053 )
51- setTransitionHooks ( block , leavingHooks )
54+ setTransitionHooks ( leavingBlock , leavingHooks )
5255
5356 if ( mode === 'out-in' ) {
5457 state . isLeaving = true
@@ -58,8 +61,23 @@ export const vaporTransitionImpl: VaporTransitionInterface = {
5861 delete leavingHooks . afterLeave
5962 }
6063 } else if ( mode === 'in-out' ) {
61- leavingHooks . delayLeave = ( block : Block , earlyRemove , delayedLeave ) => {
62- // TODO delay leave
64+ leavingHooks . delayLeave = (
65+ block : TransitionElement ,
66+ earlyRemove ,
67+ delayedLeave ,
68+ ) => {
69+ const leavingNodeCache = getLeavingNodesForBlock ( state , leavingBlock )
70+ leavingNodeCache [ String ( leavingBlock . key ) ] = leavingBlock
71+ // early removal callback
72+ block [ leaveCbKey ] = ( ) => {
73+ earlyRemove ( )
74+ block [ leaveCbKey ] = undefined
75+ delete enterHooks . delayedLeave
76+ }
77+ enterHooks . delayedLeave = ( ) => {
78+ delayedLeave ( )
79+ delete enterHooks . delayedLeave
80+ }
6381 }
6482 }
6583 return leavingHooks
@@ -70,7 +88,7 @@ export const vaporTransitionImpl: VaporTransitionInterface = {
7088}
7189
7290function resolveTransitionHooks (
73- block : Block & { key : string } ,
91+ block : Block ,
7492 props : TransitionProps ,
7593 state : TransitionState ,
7694 instance : GenericComponentInstance ,
0 commit comments