I'm having trouble sequencing tiers of computation in my app. I'm using an Akita entity store to manage state and then observing changes and piping them through observables to generate the UI state. The overall flow is:
EntityStore.selectAll()
-> pluck A \ / combineLatest(A, B) -> map Q
-> pluck B | | combineLatest(A, C) -> map R
-> pluck C |-> -| combineLatest(B, E) -> map S
... | | ...
-> pluck N / \ combineLatest(C, D) -> map Z
(Assume distinctUntilChanged after each operator).
How do I ensure that A..N are calculated before any of their combinations? Ideally all in a single macro-cycle so the UI doesn't update with partial results.
I tried adding asapScheduler
as the last parameter on combineLatest, but it doesn't seem to work, with some inputs updating before combineLatest is called and some after triggering more calls.
I'd also like to be able to add another level of combinations:
EntityStore.selectAll()
-> pluck A \ / combineLatest(A, B) -> map Q \ / combineLatest(Q, R) -> map W
-> pluck B | | combineLatest(A, C) -> map R | | combineLatest(Q, S) -> map X
-> pluck C |-> -| combineLatest(B, E) -> map S |-> -| combineLatest(S, T) -> map Y
... | | ... | | ...
-> pluck N / \ combineLatest(C, D) -> map U / \ combineLatest(R, U) -> map Z
How do I ensure that A..N are all calculated before Q..U and similarly, Q..U before W..Z?