Files
Tom MoorandClaude 9ea360995f feat: Optimistic model saves with rollback on failure (#14593)
* feat: Make model.save() optimistic with rollback on failure

Apply saved params to the model immediately so MobX observers update
without waiting for the server, and roll the model back to its previous
state when the request fails. New models with a client-generated id are
optimistically added to the store and removed again on failure.

* chore: Apply formatter and test naming convention

* fix: Scope optimistic saves to passed fields and confirmed values

Only fields passed to save() are applied optimistically, and a failure
reverts a field only while it still holds the optimistic value. Change
hooks compare against the last confirmed values so they run when the
server responds. The optimistic store add is removed.

* refactor: Use optimistic save for preferences and field toggles

Add savePreference to User, Team and Document, and pass changed fields to
save() so they revert on failure.

* fix: Only compare incoming fields against confirmed values in change hooks

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-15 09:26:55 -05:00
..