I built a small library for handling state in a transactional way, which gives you automatic conflict resolution and rollback of optimistic updates. It solves some issues I had implementing client-server sync and optimistic updates - so much manual tracking is involved making sure old requests that finish after newer requests aren't overwriting fresh state, and making sure rolling back optimistic updates of older requests isn't destroying the optimistic updates of newer requests. Especially when two different requests touch the same part of your state.