Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/sidenav): remove deprecated API usage #30268

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions src/material/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
AfterContentChecked,
AfterContentInit,
afterNextRender,
AfterRenderPhase,
AfterViewInit,
ANIMATION_MODULE_TYPE,
ChangeDetectionStrategy,
Expand Down Expand Up @@ -943,31 +942,21 @@ export class MatDrawerContainer implements AfterContentInit, DoCheck, OnDestroy
* re-validate drawers when the position changes.
*/
private _watchDrawerPosition(drawer: MatDrawer): void {
if (!drawer) {
return;
}
// NOTE: We need to wait for the microtask queue to be empty before validating,
// since both drawers may be swapping positions at the same time.
drawer.onPositionChanged.pipe(takeUntil(this._drawers.changes)).subscribe(() => {
afterNextRender(
() => {
this._validateDrawers();
},
{injector: this._injector, phase: AfterRenderPhase.Read},
);
afterNextRender({read: () => this._validateDrawers()}, {injector: this._injector});
});
}

/** Subscribes to changes in drawer mode so we can run change detection. */
private _watchDrawerMode(drawer: MatDrawer): void {
if (drawer) {
drawer._modeChanged
.pipe(takeUntil(merge(this._drawers.changes, this._destroyed)))
.subscribe(() => {
this.updateContentMargins();
this._changeDetectorRef.markForCheck();
});
}
drawer._modeChanged
.pipe(takeUntil(merge(this._drawers.changes, this._destroyed)))
.subscribe(() => {
this.updateContentMargins();
this._changeDetectorRef.markForCheck();
});
}

/** Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element. */
Expand Down
Loading