The issue seems to be somewhere in calling share() on model$ stream, and subscribing to it with two streams html$ and sub$ where the second one is built with switchMap.
Without change from this PR, subscriptions function passed to model$.switchMap does not get called with initial model.
Few more observations:
If share() method call is removed on model$ stream, subscriptions function is called with initial model. That leads to undesired behavior where calling modelCompare and mapping of state to model happens twice, which was surely the reason to introduce share().
If html$ subscription is removed and sub$ remains the only subscription to model$, subscriptions function is called with initial model.
With my limited knowledge of rxjs this was the only fix I could find, which has no undesired behavior changes.
This seems like a hacky way to fix #10.
The issue seems to be somewhere in calling
share()
onmodel$
stream, and subscribing to it with two streamshtml$
andsub$
where the second one is built withswitchMap
. Without change from this PR, subscriptions function passed tomodel$.switchMap
does not get called with initial model.Few more observations:
share()
method call is removed onmodel$
stream, subscriptions function is called with initial model. That leads to undesired behavior where calling modelCompare and mapping of state to model happens twice, which was surely the reason to introduceshare()
.html$
subscription is removed andsub$
remains the only subscription tomodel$
, subscriptions function is called with initial model.With my limited knowledge of
rxjs
this was the only fix I could find, which has no undesired behavior changes.