I am facing a RxJS issue.
My app is currently designed as follows: I have two different clients: ClientA
& ClientB
that subscribe to two different Observables: ObservableA
& ObservableB
.
Note that the app also mutates a variable called aVariable
.
Here is the flow:
ClientA
subscribes toObservableA
.ClientB
subscribes toObservableB
.ObservableB
subscription readfalse
fromaVariable
and completes.ObservableA
subscription setsaVariable
totrue
and completes (later thanObservableB
).
Whereas what is really intended was for ObservableA
's subscription to complete before ObservableB
's so that ClientB
would read true
from aVariable
... Or to put it another way, somehow ensure that ObservableB
's subscription waits till the other subscription has completed.
I am not sure what RxJS construct to use in order to achieve what I want (I currently use plain Observables). I believe I need more than plain Observables here...
Can someone please help?
P.S. Note that aVariable
is held in a ngrx store but I don't think that is relevant to this issue...
P.P.S. The above is a simplification of my real app.