▲ | bastawhiz 6 days ago | |
The only situation I can think of where it's always safe is if the order that you apply changes to the state never matters: - Each action increments or decrements a counter - You have a log of timestamps of actions stored as a set - etc. If you can't model your changes to the data store as an unordered set of actions and have that materialize into state, you will have data loss. Consider a scenario with three clients which each dispatch an action. If action 1 sets value X to true, action 2 sets it to true, and action 3 sets it to false, you have no way to know whether X should be true or false. Even with timestamps, unless you have a centralized writer you can't possibly know whether some/none/all of the timestamps that the clients used are accurate. Truly a hard problem! |