Message from JavaScript discussions
December 2016
— I've gone off the rails... I wound up making an action execution manager
Why? I predicted a special problem. Since each action gets a COPY of state, which it updates the store with: what happens when 2 actions on the same store get fired at the same time? The last action to update the store would overwrite the changes of the first
— And I can't just let actions mutate state directly...
— So the manager adds actions to a queue and executes them asynchronously, updating a temporary state object. Once all the actions are done and the queue is empty, THEN state gets updated :3
— Also! to solve the problem of different actions having different state, I made it so they don't GET the actual state, but rather the PENDING state of the current queue!
— So per-cycle of executed actions, they all act on the same mutable, pending state
— Floofies you are solving a problem that you dont need to have
— Two actions cannot fire at the same
— If you are mutating the state based on the previous state, read the state with each event that mutates it
— React does that, look for the setState docs
— I am not using react
— I am building a Flux framework