-
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
Remove mergeScan or provide better documentation for it #2737
Comments
/cc'ing @trxcllnt too for visibility. |
cc @trxcllnt ... this was his brain child back in the infancy of this lib. |
Just for reference, here's the decision tree for it:
rxjs/doc/decision-tree-widget/tree.yml Line 117 in be91989
|
It's my understanding that the |
mergeScan works like flatMap with an accumulated value. It isn't as commonly used as either flatMap or scan, but it isn't something that's easily accomplished by a combination of other operators, which is why it exists. There should also be a corresponding |
My query isn't about how
In fact, the first ten pages of GitHub results searching for
Pun intended? 😂 |
We can consider removing mergeScan for v6... It's a breaking change. However, by that version we should have treeshaking working, so I don't see the benefit to removing it other than to keep us from needing to maintain it... which has been zero maintenance so far. |
Just so you know I'm using But in fact I'm using |
On our project we are also using We've just run into the race condition problem and it would be great if there would be an |
There are certain paging scenarios where it makes sense as well, see: https://stackoverflow.com/questions/45383857/building-an-infinite-scrolling-list-in-typescript-with-rxjs5/45405933#45405933 Granted I still haven't found a use case for concurrency greater than 1, unless your data was order agnostic. |
mergeScan solves an important scenario for me, where I have a sequence of async calls. Say, first call gets an user record from a DB, second call is to external service and passes user's attributes obtained from the first call, third call is to yet another service, and requires some data from first and the second calls. Passing an accumulator with intermediate results which mergeScan does makes this pretty straightforward. |
I think we need better documentation sure... but we're not going to remove it for now. :) @ladyleet, can you please have the docs folks take a look at documenting this one better? |
for sure @benlesh! |
Referenced here ReactiveX/rxjs-docs#169 |
Please don't get rid of it very useful as a concatScan with concurrency = 1 |
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. |
I have a problem with
mergeScan
, namely, I can't think of a single situation in which it'd be needed. The categories I see of problems almost needingmergeScan
are:scan
). The example in the docs is in this categorymergeMap
). For instance, successive async calls.mergeScan
falls flat on its face, as the accumulator passed in could be stale by the time the inner observable returns. In this case, it's better to just For example, see this (entirely contrived) example where I sum the weight of the first 10 Pokémon: http://jsbin.com/qosiwenaqi/edit?js,consoleIn short, I don't see a use for
mergeScan
that isn't better served by another operator and worse, it can cause unintended race conditions.So, as a "What do we do about this issue", I'd like either:
mergeScan
operator from RxJS v5or
mergeScan
in the docs so silly folks don't open elaborate issues demanding its removal(Both @robwormald and @rgbkrk have discussed this with me in various Slacks so I'm cc'ing them here)
The text was updated successfully, but these errors were encountered: