Open rkpatel33 opened 6 years ago
What you are trying to achieve is what gaearon/redux-thunk or redux-saga/redux-saga does for redux. That is chain together asynchronous operations/side-effects.
Reflux way of achieving this is through child actions (with async enabled.) Have a look at the documentation at https://github.com/reflux/refluxjs/tree/master/docs/actions#asynchronous-loading-via-child-actions
Got it, thanks for the response!
this demo is to easy, can provide a complete demo ?
I would like to use
asyc
/await
instead of flux async actions withaction.completed
/action.failed
child actions, but after staring at some of the issues related to async actions, I'm unsure how to proceeds. I've looked at this one in particular:https://github.com/reflux/refluxjs/issues/524
The core of what I am trying to accomplish is to call two async actions aimed at to different stores, one after the other in a React component as follows:
My
ChannelQueueStore
as currently implemented is defined below, and as written the above code does not work.ChatActions.updateChannel
is triggered immediately afterChannelQueueActions.loadTickets
instead of waiting.I'm wondering if someone can suggest a way to refactor the below code so the above will work.
I could call
ChatActions.updateChannel(this.state.selectedChannel)
from at the end ofonLoadTickets
, which works but seems like bad form, and I think putting both action calls in the component itself makes it easier to see whats going on in the component.Thx.