Server: each handler is plain live(async (ctx, args) => ...).
With forceFail in the args, the handler waits 400ms and
then throws LiveError('FORCED', ...). The wait is
deliberate and it is the only artificial thing here: rejecting at once
made the placeholder's whole life a single local round trip, so the
rows this page is about appeared and vanished inside a few tens of
milliseconds and you saw a toast over a list that never visibly
changed. The failure is already artificial, so delaying it costs
nothing real and is what makes the rollback observable.
Client: addTodo.createOptimistic(store, [args], change) applies change to the displayed value, runs the RPC,
and on reject rolls back the change. The displayed value is
recomputed by replaying any other in-flight mutations against the
latest server state, so concurrent failures don't smear each
other.