@@ -935,22 +935,30 @@ export class OAuthService extends AuthConfig {
935
935
) ;
936
936
}
937
937
938
+ // only run in Angular zone if it is 'changed' or 'error'
938
939
switch ( e . data ) {
939
940
case 'unchanged' :
940
941
this . handleSessionUnchanged ( ) ;
941
942
break ;
942
943
case 'changed' :
943
- this . handleSessionChange ( ) ;
944
+ this . ngZone . run ( ( ) => {
945
+ this . handleSessionChange ( )
946
+ } ) ;
944
947
break ;
945
948
case 'error' :
946
- this . handleSessionError ( ) ;
949
+ this . ngZone . run ( ( ) => {
950
+ this . handleSessionError ( )
951
+ } ) ;
947
952
break ;
948
953
}
949
954
950
955
this . debug ( 'got info from session check inframe' , e ) ;
951
956
} ;
952
957
953
- window . addEventListener ( 'message' , this . sessionCheckEventListener ) ;
958
+ // prevent Angular from refreshing the view on every message (runs in intervals)
959
+ this . ngZone . runOutsideAngular ( ( ) => {
960
+ window . addEventListener ( 'message' , this . sessionCheckEventListener ) ;
961
+ } ) ;
954
962
}
955
963
956
964
private handleSessionUnchanged ( ) : void {
@@ -1029,10 +1037,12 @@ export class OAuthService extends AuthConfig {
1029
1037
1030
1038
private startSessionCheckTimer ( ) : void {
1031
1039
this . stopSessionCheckTimer ( ) ;
1032
- this . sessionCheckTimer = setInterval (
1033
- this . checkSession . bind ( this ) ,
1034
- this . sessionCheckIntervall
1035
- ) ;
1040
+ this . ngZone . runOutsideAngular ( ( ) => {
1041
+ this . sessionCheckTimer = setInterval (
1042
+ this . checkSession . bind ( this ) ,
1043
+ this . sessionCheckIntervall
1044
+ ) ;
1045
+ } ) ;
1036
1046
}
1037
1047
1038
1048
private stopSessionCheckTimer ( ) : void {
0 commit comments