From c25def427c0eff9dd677b79d5b2bf923061a4b7f Mon Sep 17 00:00:00 2001 From: splincode Date: Sat, 14 Sep 2024 19:13:36 +0300 Subject: [PATCH] fix(cdk): unsubscribe from swipe service when directive is destroyed --- projects/cdk/directives/swipe/swipe.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/cdk/directives/swipe/swipe.service.ts b/projects/cdk/directives/swipe/swipe.service.ts index c7f7b4a95d6f..130b266e87af 100644 --- a/projects/cdk/directives/swipe/swipe.service.ts +++ b/projects/cdk/directives/swipe/swipe.service.ts @@ -15,7 +15,7 @@ export class TuiSwipeService extends Observable { const el = tuiInjectElement(); const {timeout, threshold} = inject(TUI_SWIPE_OPTIONS); - super((subscriber) => { + super((subscriber) => merge( tuiTypedFromEvent(el, 'touchstart', {passive: true}), tuiTypedFromEvent(doc, 'touchend'), @@ -53,8 +53,8 @@ export class TuiSwipeService extends Observable { }), filter(tuiIsPresent), ) - .subscribe(subscriber); - }); + .subscribe(subscriber), + ); } }