Optimistic UI and Rollback
Provide instant user feedback while preserving correctness under server rejection or conflicts.
Pattern level: meso
Provide instant user feedback while preserving correctness under server rejection or conflicts.
Pattern level: meso
Optimistically apply local state for perceived speed, then confirm or rollback using server acknowledgements and idempotent operation IDs.
Separate pending local state from confirmed canonical state to keep reconciliation predictable.
Choose optimistic updates when server success probability is high and rollback semantics are understandable.
| Category | Level | Requirement | Done When |
|---|---|---|---|
| functional | unit | Incoming events respect sequence and dedupe semantics. | Out-of-order, duplicate, and missing event tests are all covered. |
| functional | integration | Reconnect path correctly hydrates snapshot and applies deltas. | Reconnect test proves no duplicate rows or missing updates. |
| a11y | integration | Live updates are announced without overwhelming screen readers. | Announcement batching and wording pass manual SR checks. |
| a11y | e2e | Focus remains stable when real-time updates occur. | Keyboard-only user can continue primary task uninterrupted. |
title: "Optimistic UI and Rollback" summary: "Deliver responsive interactions while preserving eventual consistency." kind: "pattern" level: "meso" tags: ["reliability", "state-management", "testing"] usedIn:
Apply updates immediately with temporary IDs or pending flags, then reconcile on server confirmation.
| Category | Level | Requirement | Done When |
|---|---|---|---|
| functional | unit | Incoming events respect sequence and dedupe semantics. | Out-of-order, duplicate, and missing event tests are all covered. |
| functional | integration | Reconnect path correctly hydrates snapshot and applies deltas. | Reconnect test proves no duplicate rows or missing updates. |
| a11y | integration | Live updates are announced without overwhelming screen readers. | Announcement batching and wording pass manual SR checks. |
| a11y | e2e | Focus remains stable when real-time updates occur. | Keyboard-only user can continue primary task uninterrupted. |