-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsubscribe from a combineLatest doesn't unsubscribe from underlying observables #7318
Comments
I think this is because of the test setup.... you are mocking the Note that observables do get unsubscribed when using regular operators, you can observe this behavior in the example provided here: https://codesandbox.io/s/rxjs-playground-3rkq8z?file=/src/index.ts When using an observable through an operator, it doesn't receive a user-land observer through the rxjs/src/internal/observable/combineLatest.ts Lines 214 to 217 in 2947583
So, to clarify, internally, the subscription returned by subscribe is not utilized. Instead, a different mechanism is employed to unsubscribe. This issue highlights another instance where Interestingly, one of the arguments against that suggestion was that RxJS' operators wouldn't work with "standard observables." I think it would really help if you can show a use case where this is problematic without mocking out the |
Describe the bug
Since the version 7.x.x, the behavior seems to have changes in the unsubscription mecanism for combineLatest: unsubscribe from a combineLatest doesn't unsubscribe from underlying observables
Expected behavior
Unsubscribe from a combineLatest observable should unsubscribe from underlying observables
Reproduction code
Reproduction URL
https://stackblitz.com/edit/rxjs-issue-7318?file=test%2Funsubscribe.spec.ts&terminal=test
Version
7.x.x
Environment
No response
Additional context
Change RXJS to version "^6.6.7" in package.json, and the test will pass
We can see in the code that subscription to an underlying observable is not kept in memory anymore:
rxjs/src/internal/observable/combineLatest.ts
Line 214 in 2947583
The text was updated successfully, but these errors were encountered: