Skip to content

Commit 02210d8

Browse files
crisbetojelbourn
authored andcommitted
fix(sidenav): run autosize debounce timer outside the NgZone (#18898)
Fixes the timer that we use to debounce the autosize calls being run inside the NgZone. Fixes #18894. (cherry picked from commit 27e3b9d)
1 parent c1d4597 commit 02210d8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/material/sidenav/drawer.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,13 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy
652652
this._changeDetectorRef.markForCheck();
653653
});
654654

655-
this._doCheckSubject.pipe(
656-
debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps
657-
takeUntil(this._destroyed)
658-
).subscribe(() => this.updateContentMargins());
655+
// Avoid hitting the NgZone through the debounce timeout.
656+
this._ngZone.runOutsideAngular(() => {
657+
this._doCheckSubject.pipe(
658+
debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps
659+
takeUntil(this._destroyed)
660+
).subscribe(() => this.updateContentMargins());
661+
});
659662
}
660663

661664
ngOnDestroy() {

0 commit comments

Comments
 (0)