# recipes/optimistic-write

A write that applies locally before the server sees it, is refused, and is rolled back.

Recipe: an optimistic write the server refuses.

The client writes at once, without asking. Most of the time that is right and the write simply crosses. When it is not, the write has already landed locally and has to be taken back. This is the whole round trip, including the rollback most applications forget.

## Files

- [`main.ts`](/docs/recipes/optimistic-write/files/main.ts)
