ngneat / until-destroy

🦊 RxJS operator that unsubscribe from observables on destroy
https://netbasal.com/
MIT License
1.74k stars 100 forks source link

Supporting other types of Subscriptions #226

Closed simon1389 closed 1 year ago

simon1389 commented 1 year ago

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?

arturovt commented 1 year ago

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