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 have a strange experience happening with Alt.js I could use some thoughts on.
I have a Store that uses bindListeners to bind an action to another store's action. It works, however, the action fires much later than if I use MyStore.listen(...) and dispatch my action from within that callback.
The basic setup is
Dispatch ActionA from StoreA
When a response is received from the server, dispatch ActionB from StoreA, which updates StoreA.myProp.
In StoreB, bindListeners ActionC to StoreA.ActionB ...waitFor(StoreA) and read StoreA.getState().myProp
ActionC fires when StoreA.ActionB fires.
This takes 7-8 seconds including round-trip to server.
The faster way is
Dispatch ActionA from StoreA
When a response is received from the server, dispatch ActionB from StoreA, which updates StoreA.myProp
Use React componentDidMount() to StoreA.listen((state) => { StoreB.ActionC.defer() }) where the state has an updated StoreA.myProp before StoreA.ActionB even appears to dispatch...
This takes 2-3 seconds including round-trip to server.
Any thoughts???
The text was updated successfully, but these errors were encountered:
I have a strange experience happening with Alt.js I could use some thoughts on.
I have a Store that uses bindListeners to bind an action to another store's action. It works, however, the action fires much later than if I use MyStore.listen(...) and dispatch my action from within that callback.
The basic setup is
ActionA
fromStoreA
ActionB
fromStoreA
, which updatesStoreA.myProp
.StoreB
, bindListenersActionC
toStoreA.ActionB
...waitFor(StoreA)
and readStoreA.getState().myProp
ActionC
fires whenStoreA.ActionB
fires.This takes 7-8 seconds including round-trip to server.
The faster way is
ActionA
fromStoreA
ActionB
fromStoreA
, which updatesStoreA.myProp
componentDidMount()
toStoreA.listen((state) => { StoreB.ActionC.defer() })
where the state has an updatedStoreA.myProp
beforeStoreA.ActionB
even appears to dispatch...This takes 2-3 seconds including round-trip to server.
Any thoughts???
The text was updated successfully, but these errors were encountered: