ngneat / until-destroy

🦊 RxJS operator that unsubscribe from observables on destroy

Home Page:https://netbasal.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supporting other types of Subscriptions

simon1389 opened this issue · comments

In libs/until-destroy/src/lib/until-destroy.ts in line 17 you are checking for the properties to be of type Subscription from the rxjs package.
There are also other types of suscriptions, which also support unsubscribing, but which would not pass that check.
i.e. when dealing with aws graphql subscriptions you get an ZenObservable.Subscription.
Currently it's not possible to unsubscribe that type of subscriptions with your decorator.

Maybe just checking for the presence of the .unsubscribe function would be sufficient at that point?

We don't support other types of subscriptions because unsubscribe() might also exist on other objects as Subject.