-
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
Early completions of switchMap()
#2714
Comments
@matthewwithanm does this work? source.publish((xs) => xs
.switchMap(project)
.takeUntil(xs.lastOrDefault(0))) |
Hey @trxcllnt! |
use |
Thanks @paulpdaniels! I understood @trxcllnt's response but I was really looking for answers to the questions in the OP—especially 2. I'm assuming your answer to (3) is that combining these five operators ( |
Closing as stale. |
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. |
We use
switchMap()
a lot, but recently @shushz raised the point that, most of the time, we actually don't want its completion semantics. WhereasswitchMap()
completes when both the inner and outer observable do, we often want it to complete as soon as the outer one does (similar to error propagation).As a use case, consider the old typeahead example where you have an observable of strings ("A") that get switchMapped to a http request. It seems natural to have A complete when, for example, the input field is removed from the document, but that doesn't give the most desirable behavior (cancelling the request). The behavior you want would actually be something like:
or maybe something with
.switchMap(...).takeUntil(...)
.So now we're wondering
or maybe we're just missing something obvious?
cc @hansonw @trxcllnt
Somewhat related: #1815
The text was updated successfully, but these errors were encountered: