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

Observables with shareReplay(1) - being re-evaluated when refCount becomes 0 #2908

Closed
shinok01 opened this issue Oct 5, 2017 · 2 comments · Fixed by #2910
Closed

Observables with shareReplay(1) - being re-evaluated when refCount becomes 0 #2908

shinok01 opened this issue Oct 5, 2017 · 2 comments · Fixed by #2910
Labels
bug Confirmed bug

Comments

@shinok01
Copy link

shinok01 commented Oct 5, 2017

RxJS version:
v5.4.2

Code to reproduce:
https://plnkr.co/edit/ZInWDJSuzfKEvtEOUBir?p=preview
Uncomment the call to subscribe to reproduce the issue

Expected behavior:
shareReplay(1) subjects should not be torn down when refCount becomes 0.

Actual behavior:
When refCount becomes 0, the underlying subject is torn down, causing the observable to be re-evaluated when the next subscription is registered.

Additional information:

@benlesh benlesh added the bug Confirmed bug label Oct 5, 2017
@benlesh
Copy link
Member

benlesh commented Oct 5, 2017

I've confirmed this as a bug.

benlesh added a commit that referenced this issue Oct 6, 2017
When the refCount hits zero, and the source has neither completed nor errored, `shareReplay` will now properly stay subscribed to the source, and retain the internal ReplaySubject that is caching values

fixes #2908
@lock
Copy link

lock bot commented Jun 6, 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 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants