Skip to content

Commit e651389

Browse files
damyanpetevkdinev
authored andcommitted
refactor(toggle): update overlay subscription filter to tuple (#2898)
1 parent c996f2f commit e651389

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

projects/igniteui-angular/src/lib/directives/toggle/toggle.directive.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { IgxNavigationService, IToggleView } from '../../core/navigation';
1717
import { IgxOverlayService } from '../../services/overlay/overlay';
1818
import { OverlaySettings, OverlayEventArgs, ConnectedPositioningStrategy, AbsoluteScrollStrategy } from '../../services';
1919
import { filter, takeUntil } from 'rxjs/operators';
20-
import { Subscription, OperatorFunction, Subject } from 'rxjs';
20+
import { Subscription, Subject, MonoTypeOperatorFunction } from 'rxjs';
2121
import { OverlayCancelableEventArgs } from '../../services/overlay/utilities';
2222
import { CancelableEventArgs } from '../../core/utils';
2323

@@ -28,8 +28,9 @@ import { CancelableEventArgs } from '../../core/utils';
2828
export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
2929
private _overlayId: string;
3030
private destroy$ = new Subject<boolean>();
31-
private _overlaySubFilter: OperatorFunction<OverlayEventArgs, OverlayEventArgs>[] = [
32-
filter(x => x.id === this._overlayId)
31+
private _overlaySubFilter: [MonoTypeOperatorFunction<OverlayEventArgs>, MonoTypeOperatorFunction<OverlayEventArgs>] = [
32+
filter(x => x.id === this._overlayId),
33+
takeUntil(this.destroy$)
3334
];
3435
private _overlayOpenedSub: Subscription;
3536
private _overlayClosingSub: Subscription;
@@ -189,12 +190,12 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
189190
}
190191

191192
this.unsubscribe();
192-
this._overlayOpenedSub = this.overlayService.onOpened.pipe(...this._overlaySubFilter, takeUntil(this.destroy$)).subscribe(() => {
193+
this._overlayOpenedSub = this.overlayService.onOpened.pipe(...this._overlaySubFilter).subscribe(() => {
193194
this.onOpened.emit();
194195
});
195196
this._overlayClosingSub = this.overlayService
196197
.onClosing
197-
.pipe(...this._overlaySubFilter, takeUntil(this.destroy$))
198+
.pipe(...this._overlaySubFilter)
198199
.subscribe((e: OverlayCancelableEventArgs) => {
199200
const eventArgs: CancelableEventArgs = { cancel: false };
200201
this.onClosing.emit(eventArgs);
@@ -208,7 +209,7 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
208209
}
209210
});
210211
this._overlayClosedSub = this.overlayService.onClosed
211-
.pipe(...this._overlaySubFilter, takeUntil(this.destroy$))
212+
.pipe(...this._overlaySubFilter)
212213
.subscribe(this.overlayClosed);
213214
}
214215

0 commit comments

Comments
 (0)