Skip to content
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

Inner subscription teardown with multiple instances of Rx #3443

Closed
kobelb opened this issue Mar 16, 2018 · 4 comments
Closed

Inner subscription teardown with multiple instances of Rx #3443

kobelb opened this issue Mar 16, 2018 · 4 comments

Comments

@kobelb
Copy link

kobelb commented Mar 16, 2018

RxJS version: 5.5.7

Code to reproduce:
https://github.com/kobelb/rxjs-multiple/blob/master/index.js

Expected behavior:
The teardown/unsubscription logic in the inner subscription should be called

Actual behavior:
The teardown logic isn't called

Additional information:
There's some interesting behavior with inner subscriptions teardown logic when using different "instances" of RxJs, even if they're the same version. I ran into a situation when working on a plugin for Kibana where the main Kibana project is exposing an interface based on Observables for the plugins to consume, but the teardown logic for the inner subscriptions wasn't being called. I've managed to trace the culprit down to the Kibana project and the plugin importing RxJs from each of their respective node_modules, even though they're the same version they're different "instances".

Interestingly, if I remove the .map(i => i) from the inner subscription everything works correctly.

@kwonoj
Copy link
Member

kwonoj commented Mar 16, 2018

Rx core internally rely on some object checks like instanceof, having multiple installation of Rx and interopping between 2 Observable is not supported (will have various unexpected side effect). We may improve error handling better in further, but any cases it's not supported and need to ensure application only have single imports of Rx.

@kobelb
Copy link
Author

kobelb commented Mar 16, 2018

Thanks for responding @kwonoj, will this situation change at all when 6.0.0 is released?

@kwonoj
Copy link
Member

kwonoj commented Mar 16, 2018

not at this moment. if it happens, directly will be probably raise a warning for multiple instances.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants