I have the following RxJS subscription :
combineLatest([obs1$, obs2$])
.pipe(
filter(val=>!!val[0] && !!val[1]), // no null value on both
switchMap(([val1, val2]) => combineLatest([of(v1), getObs3$(v2)]))
)
.subscribe(([val1, val3]) => { ... });
The code works like intended but it feels cumbersome. I am quite sure the switchMap into combineLatest with an of() opertor is improvable.
Note : In order to call the getObs3$(v2) I need to be sure that the value in obs1$ first. Also, i do need the val1 in the subscription since i will use it later on.
Any one got an idea on how to optimize this one ?