Remote / Declared writes

Optimistic previews in the browser

While a declared write is in flight, Data.mutate layers set values and relative increment amounts over cached store rows on read:

  • Concurrent live updates merge underneath pending increments rather than being clobbered.
  • Multiple pending increments sum cleanly, and dismissing one leaves the others intact.
  • Queries sort and place optimistic rows whenever all needed fields are held locally.
  • Unfetched fields wait for the server response instead of guessing.

Client previews and local refusals (Invalid from held invariants or Forbidden from held may flags; see What the client may do) save round trips without replacing server enforcement. Inspect Write.reads(write) and Write.writes(write) to see which fields a write depends on or modifies.