Reputation: 5007
https://gist.github.com/criso/086881ec8df844eda73a
Should these independent components be using different dispatchers
?
Scenario:
Compnonent BAR
requests data from the server via an action REQ_BAR
Component FOO
receives data from a previous request REQ_FOO_SUCCESS
--- Cannot dispatch in the middle of a dispatch. ---
error is triggered
Basically, if you have 2 components that retrieve data from the server:
- component FOO
may be dispatching REQ_FOO
- while component BAR
may be dispatching REQ_BAR_SUCCESS
Upvotes: 2
Views: 1106
Reputation: 954
You can use waitFor
in Flux. So you fire one action
and have two stores
that are register to the same dispatcher. But one waits for the other store to process the payload.
Check out the doc
Upvotes: 1
Reputation: 5007
Just saw this:
https://github.com/facebook/flux/issues/47#issuecomment-54716863
"An action queue would not be a bad solution if you have multiple async API calls coming back at the same time."
I don't see how you may not run into this at some point.
Upvotes: 0