These are chat archives for jdubray/sam-examples

24th
Apr 2016
Jean-Jacques Dubray
@jdubray
Apr 24 2016 02:18
Yes, but this is called from within the model, not the actions.
the rationale is that there is no point in rendering the view until the model has persisted and the persistence layer has also accepted the values of the model. If you could be guaranteed that whatever value has been accepted by the model will persist as is, then you could use actions in nap().
the other aspect to consider is concurrency. As soon as actions can be triggered and processed before the present model has completed, then you will run into concurrency issues. The SAFE middleware "blocks" the present method and serializes all action execution, in particular it would check for the "allowedActions" in the new State before processing an action waiting in the queue.
Jean-Jacques Dubray
@jdubray
Apr 24 2016 02:25
I believe that's the problem with React, the reducer could technically process more than one action, then depending which one finishes first would be immediately overwritten by the last one.
You have to always ask the concurrency question when you build such a system.
dnson
@imnutz
Apr 24 2016 03:37
@jdubray thank you for reviewing and explaining this.
Jean-Jacques Dubray
@jdubray
Apr 24 2016 11:19
you are welcome, again happy to discuss better alternatives, this is a very important question