@@ -734,8 +734,8 @@ export class TransitionAnimationEngine {
734734
735735 // if a unmatched transition is queued to go then it SHOULD NOT render
736736 // an animation and cancel the previously running animations.
737- if ( entry . isFallbackTransition && ! instruction . isRemovalTransition ) {
738- eraseStyles ( element , instruction . fromStyles ) ;
737+ if ( entry . isFallbackTransition ) {
738+ player . onStart ( ( ) => eraseStyles ( element , instruction . fromStyles ) ) ;
739739 player . onDestroy ( ( ) => setStyles ( element , instruction . toStyles ) ) ;
740740 skippedPlayers . push ( player ) ;
741741 return ;
@@ -790,6 +790,14 @@ export class TransitionAnimationEngine {
790790 }
791791 } ) ;
792792
793+ skippedPlayers . forEach ( player => {
794+ const element = player . element ;
795+ const previousPlayers =
796+ this . _getPreviousPlayers ( element , false , player . namespaceId , player . triggerName , null ) ;
797+ previousPlayers . forEach (
798+ prevPlayer => { getOrSetAsInMap ( allPreviousPlayersMap , element , [ ] ) . push ( prevPlayer ) ; } ) ;
799+ } ) ;
800+
793801 allPreviousPlayersMap . forEach ( players => players . forEach ( player => player . destroy ( ) ) ) ;
794802
795803 const leaveNodes : any [ ] = bodyNode && allPostStyleElements . size ?
@@ -919,8 +927,8 @@ export class TransitionAnimationEngine {
919927 afterFlushAnimationsDone ( callback : ( ) => any ) { this . _whenQuietFns . push ( callback ) ; }
920928
921929 private _getPreviousPlayers (
922- element : string , instruction : AnimationTransitionInstruction , isQueriedElement : boolean ,
923- namespaceId ?: string , triggerName ?: string ) : TransitionAnimationPlayer [ ] {
930+ element : string , isQueriedElement : boolean , namespaceId ?: string , triggerName ?: string ,
931+ toStateValue ?: any ) : TransitionAnimationPlayer [ ] {
924932 let players : TransitionAnimationPlayer [ ] = [ ] ;
925933 if ( isQueriedElement ) {
926934 const queriedElementPlayers = this . playersByQueriedElement . get ( element ) ;
@@ -930,10 +938,10 @@ export class TransitionAnimationEngine {
930938 } else {
931939 const elementPlayers = this . playersByElement . get ( element ) ;
932940 if ( elementPlayers ) {
933- const isRemovalAnimation = instruction . toState == VOID_VALUE ;
941+ const isRemovalAnimation = ! toStateValue || toStateValue == VOID_VALUE ;
934942 elementPlayers . forEach ( player => {
935943 if ( player . queued ) return ;
936- if ( ! isRemovalAnimation && player . triggerName != instruction . triggerName ) return ;
944+ if ( ! isRemovalAnimation && player . triggerName != triggerName ) return ;
937945 players . push ( player ) ;
938946 } ) ;
939947 }
@@ -943,7 +951,7 @@ export class TransitionAnimationEngine {
943951 if ( namespaceId && namespaceId != player . namespaceId ) return false ;
944952 if ( triggerName && triggerName != player . triggerName ) return false ;
945953 return true ;
946- } )
954+ } ) ;
947955 }
948956 return players ;
949957 }
@@ -970,7 +978,7 @@ export class TransitionAnimationEngine {
970978 const isQueriedElement = element !== rootElement ;
971979 const players = getOrSetAsInMap ( allPreviousPlayersMap , element , [ ] ) ;
972980 const previousPlayers = this . _getPreviousPlayers (
973- element , instruction , isQueriedElement , targetNameSpaceId , targetTriggerName ) ;
981+ element , isQueriedElement , targetNameSpaceId , targetTriggerName , instruction . toState ) ;
974982 previousPlayers . forEach ( player => {
975983 const realPlayer = player . getRealPlayer ( ) as any ;
976984 if ( realPlayer . beforeDestroy ) {
0 commit comments