From ff28dc557ba9668b8aa9890cd28c561c38b855d8 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sun, 27 Oct 2024 09:14:28 +0100 Subject: [PATCH] fix(material/sidenav): remove IE animation workaround Removes a workaround that's no longer necessary now that we don't support IE. --- src/material/sidenav/drawer.ts | 37 +++++++++------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/material/sidenav/drawer.ts b/src/material/sidenav/drawer.ts index eb3c78baec7a..b05af6537231 100644 --- a/src/material/sidenav/drawer.ts +++ b/src/material/sidenav/drawer.ts @@ -46,16 +46,7 @@ import { ViewEncapsulation, } from '@angular/core'; import {fromEvent, merge, Observable, Subject} from 'rxjs'; -import { - debounceTime, - distinctUntilChanged, - filter, - map, - mapTo, - startWith, - take, - takeUntil, -} from 'rxjs/operators'; +import {debounceTime, filter, map, mapTo, startWith, take, takeUntil} from 'rxjs/operators'; import {matDrawerAnimations} from './drawer-animations'; /** @@ -367,24 +358,16 @@ export class MatDrawer implements AfterViewInit, AfterContentChecked, OnDestroy ); }); - // We need a Subject with distinctUntilChanged, because the `done` event - // fires twice on some browsers. See https://github.com/angular/angular/issues/24084 - this._animationEnd - .pipe( - distinctUntilChanged((x, y) => { - return x.fromState === y.fromState && x.toState === y.toState; - }), - ) - .subscribe((event: AnimationEvent) => { - const {fromState, toState} = event; + this._animationEnd.subscribe((event: AnimationEvent) => { + const {fromState, toState} = event; - if ( - (toState.indexOf('open') === 0 && fromState === 'void') || - (toState === 'void' && fromState.indexOf('open') === 0) - ) { - this.openedChange.emit(this._opened); - } - }); + if ( + (toState.indexOf('open') === 0 && fromState === 'void') || + (toState === 'void' && fromState.indexOf('open') === 0) + ) { + this.openedChange.emit(this._opened); + } + }); } /**