You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a relatively large application which uses rxjs, and I often find myself needing to "concat" the items from other observable. I can do this in two ways:
So my questions are: 1) do you know a better way to achieve the same/similar behavior? I am not familiar with every rxjs operator, so maybe I just missed something.. 2) would you say this is a normal use-case, or am I doing something wrong? Would love to hear opinions on this as I'm planning to create a custom operator.
More notes:
The createObservableB is usually a ngrx selector factory, and I am only interested in latest value. For these cases I can simply use already existing concatLatestFrom from ngrx and it works fine.
The issue is when the result of createObservableB(a) is actually asynchronous, for example a from(somePromise). The ngrx concatLatestFrom simply doesn't work in this case and I have to switchMap/mergeMap..
This topic is somewhat related to #5845
and maybe also #6974
but not 100%, so I opened a new one, hope you don't mind..
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am working on a relatively large application which uses rxjs, and I often find myself needing to "concat" the items from other observable. I can do this in two ways:
and
But you can see that it's a bit clumsy.
So my questions are:
1) do you know a better way to achieve the same/similar behavior? I am not familiar with every rxjs operator, so maybe I just missed something..
2) would you say this is a normal use-case, or am I doing something wrong? Would love to hear opinions on this as I'm planning to create a custom operator.
More notes:
The
createObservableB
is usually a ngrx selector factory, and I am only interested in latest value. For these cases I can simply use already existingconcatLatestFrom
from ngrx and it works fine.The issue is when the result of
createObservableB(a)
is actually asynchronous, for example afrom(somePromise)
. The ngrxconcatLatestFrom
simply doesn't work in this case and I have to switchMap/mergeMap..This topic is somewhat related to
#5845
and maybe also
#6974
but not 100%, so I opened a new one, hope you don't mind..
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions