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

Note about completions seems unclear in bind() #45

Open
hoclun-rigsep opened this issue Jul 16, 2021 · 1 comment
Open

Note about completions seems unclear in bind() #45

hoclun-rigsep opened this issue Jul 16, 2021 · 1 comment

Comments

@hoclun-rigsep
Copy link
Contributor

https://github.com/re-rxjs/react-rxjs.org/blame/master/docs/api/core/bind.md#L32

bind doesn't propagate completions from the source stream - the shared subscription is closed as soon as there are no subscribers to that Observable.

I'm having trouble seeing how these statements relate.

@voliva
Copy link
Collaborator

voliva commented Jul 19, 2021

When an Observable completes on a shareLatest, all the observers are notified, they all unsubscribe, and the state gets reset for the next observer to subscribe.

When using bind this behaviour changes: it doesn't propagate the completion of the source stream, so all the existing observables will keep an active subscription to the shared stream. This leaves a question open: "what happens if another observer then subscribes on it?" and the answer is "it will not resubscribe to the source, it will just receive the latest value that was emitted".

Then "When will it reset its state so that it resubscribes to the source?" -> "as soon as there are no subscribers to the Observable".

I agree we need to rephrase this one better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants