combineLatestMap Operator #6707
tgrelka
started this conversation in
Ideas / Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, thank you for an amazing library with lots of syntactic sugar, which improves working with HTTP requests a lot.
When I need to call a second endpoint, for example to get additional info about an object I didn’t get from the originating observable, but also want to keep the original observable, I often use the
combineLatestWith
operator.However, this is a constant operator, similar to
switchMapTo
, where the first input observable has no effect on the combined one (except for being part of the tuple the new observable emits.)Many times, I need to wait for the first observable to emit a value, based on which I do more work, e.g. fire a second request.
Currently, I’m using this pattern to achieve the desired result:
Notice how the results of the first (
res1
) and the second (res2
) HTTP requests are swapped now. While this doesn’t pose any problems in code itself, it does require to also swap the tuple in your head. While Typescript helps to not make mistakes, keeping the original order would be much nicer.I would prefer the ability to use a
combineLatestMap
operator which would observe the emitted values of the source and then create a combined observable with observables calculated from those emitted values, simplifying the snippet above to:Beta Was this translation helpful? Give feedback.
All reactions