File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -302,11 +302,18 @@ export class MatFormField extends _MatFormFieldMixinBase
302
302
303
303
// @breaking -change 7.0.0 Remove this check once _ngZone is required. Also reconsider
304
304
// whether the `ngAfterContentChecked` below is still necessary.
305
- if ( this . _ngZone ) {
306
- this . _ngZone . onStable . asObservable ( ) . pipe ( takeUntil ( this . _destroyed ) ) . subscribe ( ( ) => {
307
- if ( this . _outlineGapCalculationNeededOnStable ) {
308
- this . updateOutlineGap ( ) ;
309
- }
305
+ const zone = this . _ngZone ;
306
+
307
+ if ( zone ) {
308
+ // Note that we have to run outside of the `NgZone` explicitly,
309
+ // in order to avoid throwing users into an infinite loop
310
+ // if `zone-patch-rxjs` is included.
311
+ zone . runOutsideAngular ( ( ) => {
312
+ zone . onStable . asObservable ( ) . pipe ( takeUntil ( this . _destroyed ) ) . subscribe ( ( ) => {
313
+ if ( this . _outlineGapCalculationNeededOnStable ) {
314
+ this . updateOutlineGap ( ) ;
315
+ }
316
+ } ) ;
310
317
} ) ;
311
318
}
312
319
You can’t perform that action at this time.
0 commit comments