Worked for about six hours today rebuilding the document component to account for how data will need to be modified. Doing this correctly is super important as it hopefully will prevent a host of concurrency related bugs.
The difficult part of this is how updates made to the document by a user should be immediately visibly reflected in the user's local version interface, then invisibly update according to the ground-truth version of the document held on the server.
The idea is to have the document render the most up to date version of the data -
up until the user makes some action, such as editing or moving a unit. At this point , a copy of the state is made *
, an event is dispatched to the server ↑
, and the modified copy of the data is rendered =
. Once the server responds with the new version of the data↓
, the copy is switched out for the live data -
.
------*↑====↓------
Figuring out the mechanics of implementing this across a number of components is challenging, but I'm making progress. This is an interesting area where the desired user experience directly informs how best to implement a particular part of the application. There are much easier ways to update data, but doing it this way will result in the most natural experience, which is by far the most important part.