Skip to content

Commit a5592f8

Browse files
committed
fix(material/form-field): floating label triggering callback inside zone
The floating label has a `setTimeout` inside `_handleResize` which was being called inside the zone from the `floating` setter which can trigger unnecessary change detections.
1 parent 936d179 commit a5592f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/material/form-field/directives/floating-label.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class MatFormFieldFloatingLabel implements OnDestroy {
116116
// This is expected, but If we allow this to all happen within the same macro task it causes an
117117
// error: `ResizeObserver loop limit exceeded`. Therefore we push the notch resize out until
118118
// the next macro task.
119-
setTimeout(() => this._parent._handleLabelResized());
119+
this._ngZone.runOutsideAngular(() => setTimeout(() => this._parent._handleLabelResized()));
120120
}
121121

122122
/** Subscribes to resize events. */

0 commit comments

Comments
 (0)