jcperez-ch / flaxs

const Flaxs = Flux + Redux.principles();
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Is there a way to make the dispatched payloads synchronous? #9

Closed jcperez-ch closed 8 years ago

jcperez-ch commented 8 years ago

The idea is to avoid the asynchronous gap between the action call and the store change.

We need deeper research on different posibilities:

  1. Include redux as dependency instead of starting from mcfly 0.0.10.
  2. Remove flux dependency and construct our own dispatcher.
  3. Leave the payload synchronous, but avoid the multiple event emitting on the store when dispatching reducers.
jcperez-ch commented 8 years ago

Response to this question, after research. Yes... the way mcfly handled the action dispatching was asynchronous, because it assures a resolve/reject via a promise. You can have actions that instead of returning an action descriptor, returns a promise with a resolving/rejecting action descriptor. To preserve that functionality we included a second parameter in flaxs.createActions method, explained in PR 13

jcperez-ch commented 8 years ago

Unit tests added as well, synchronous flags are used in version 1.0.4