Skip to content

Commit 493d072

Browse files
committed
fix(material/sidenav): remove deprecated API usage
The sidenav was using `AfterRenderPhase` which is deprecated. These changes switch it to the supported API.
1 parent 2219b11 commit 493d072

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/material/sidenav/drawer.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
AfterContentChecked,
2424
AfterContentInit,
2525
afterNextRender,
26-
AfterRenderPhase,
2726
AfterViewInit,
2827
ANIMATION_MODULE_TYPE,
2928
ChangeDetectionStrategy,
@@ -943,31 +942,21 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy
943942
* re-validate drawers when the position changes.
944943
*/
945944
private _watchDrawerPosition(drawer: MatDrawer): void {
946-
if (!drawer) {
947-
return;
948-
}
949945
// NOTE: We need to wait for the microtask queue to be empty before validating,
950946
// since both drawers may be swapping positions at the same time.
951947
drawer.onPositionChanged.pipe(takeUntil(this._drawers.changes)).subscribe(() => {
952-
afterNextRender(
953-
() => {
954-
this._validateDrawers();
955-
},
956-
{injector: this._injector, phase: AfterRenderPhase.Read},
957-
);
948+
afterNextRender({read: () => this._validateDrawers()}, {injector: this._injector});
958949
});
959950
}
960951

961952
/** Subscribes to changes in drawer mode so we can run change detection. */
962953
private _watchDrawerMode(drawer: MatDrawer): void {
963-
if (drawer) {
964-
drawer._modeChanged
965-
.pipe(takeUntil(merge(this._drawers.changes, this._destroyed)))
966-
.subscribe(() => {
967-
this.updateContentMargins();
968-
this._changeDetectorRef.markForCheck();
969-
});
970-
}
954+
drawer._modeChanged
955+
.pipe(takeUntil(merge(this._drawers.changes, this._destroyed)))
956+
.subscribe(() => {
957+
this.updateContentMargins();
958+
this._changeDetectorRef.markForCheck();
959+
});
971960
}
972961

973962
/** Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element. */

0 commit comments

Comments
 (0)