From 810040e8fc88d31a734eb8a584891208ae088572 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 28 Oct 2024 14:29:30 +0100 Subject: [PATCH] fix(material/sidenav): remove IE animation workaround (#29929) Removes a workaround that's no longer necessary now that we don't support IE. (cherry picked from commit 070be9f5fb6b2829fd4443685b272be44c11520e) --- 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 fcd9588e697c..392ca678318b 100644 --- a/src/material/sidenav/drawer.ts +++ b/src/material/sidenav/drawer.ts @@ -49,16 +49,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); + } + }); } /**