@@ -837,15 +837,15 @@ export class TransitionAnimationEngine {
837837 }
838838
839839 const allLeaveNodes : any [ ] = [ ] ;
840- const leaveNodesWithoutAnimations : any [ ] = [ ] ;
840+ const leaveNodesWithoutAnimations = new Set < any > ( ) ;
841841 for ( let i = 0 ; i < this . collectedLeaveElements . length ; i ++ ) {
842842 const element = this . collectedLeaveElements [ i ] ;
843843 const details = element [ REMOVAL_FLAG ] as ElementAnimationState ;
844844 if ( details && details . setForRemoval ) {
845845 addClass ( element , LEAVE_CLASSNAME ) ;
846846 allLeaveNodes . push ( element ) ;
847847 if ( ! details . hasAnimation ) {
848- leaveNodesWithoutAnimations . push ( element ) ;
848+ leaveNodesWithoutAnimations . add ( element ) ;
849849 }
850850 }
851851 }
@@ -937,12 +937,14 @@ export class TransitionAnimationEngine {
937937 }
938938
939939 // these can only be detected here since we have a map of all the elements
940- // that have animations attached to them...
941- const enterNodesWithoutAnimations : any [ ] = [ ] ;
940+ // that have animations attached to them... We use a set here in the event
941+ // multiple enter captures on the same element were caught in different
942+ // renderer namespaces (e.g. when a @trigger was on a host binding that had *ngIf)
943+ const enterNodesWithoutAnimations = new Set < any > ( ) ;
942944 for ( let i = 0 ; i < allEnterNodes . length ; i ++ ) {
943945 const element = allEnterNodes [ i ] ;
944946 if ( ! subTimelines . has ( element ) ) {
945- enterNodesWithoutAnimations . push ( element ) ;
947+ enterNodesWithoutAnimations . add ( element ) ;
946948 }
947949 }
948950
@@ -1435,9 +1437,11 @@ function cloakElement(element: any, value?: string) {
14351437}
14361438
14371439function cloakAndComputeStyles (
1438- driver : AnimationDriver , elements : any [ ] , elementPropsMap : Map < any , Set < string > > ,
1440+ driver : AnimationDriver , elements : Set < any > , elementPropsMap : Map < any , Set < string > > ,
14391441 defaultStyle : string ) : [ Map < any , ɵStyleData > , any [ ] ] {
1440- const cloakVals = elements . map ( element => cloakElement ( element ) ) ;
1442+ const cloakVals : string [ ] = [ ] ;
1443+ elements . forEach ( element => cloakVals . push ( cloakElement ( element ) ) ) ;
1444+
14411445 const valuesMap = new Map < any , ɵStyleData > ( ) ;
14421446 const failedElements : any [ ] = [ ] ;
14431447
@@ -1456,7 +1460,10 @@ function cloakAndComputeStyles(
14561460 valuesMap . set ( element , styles ) ;
14571461 } ) ;
14581462
1459- elements . forEach ( ( element , i ) => cloakElement ( element , cloakVals [ i ] ) ) ;
1463+ // we use a index variable here since Set.forEach(a, i) does not return
1464+ // an index value for the closure (but instead just the value)
1465+ let i = 0 ;
1466+ elements . forEach ( element => cloakElement ( element , cloakVals [ i ++ ] ) ) ;
14601467 return [ valuesMap , failedElements ] ;
14611468}
14621469
0 commit comments