movex
movex copied to clipboard
Sometimes need to wait for dispatch ack from master before changing local state
What
What this means is that the dev should be able to choose when an action dispatch should optimistically commit local state or wait for master ack.
Issue with RPS example:
If two clients bind to same resource simultaneously, or super close in time to each other, they both take the first available slot in the state locally, but I imagine only one does it for real. Anyhow, it should be able to wait – as the store has a locking system, and only do it once ready.
I think the solution to the above is to to be able to work with server only generated values or state (such as ids, random stuff, etc), end thus be able to wait for them, but in that case the dispatch need NOT TO optimistically update local state, but wait for the master to sync!
I believe this should work, In the future we could have some special Movex Value creators such as Movex.createRandom() or createId or etc..which will turn off the optimistic local update by default.