Modern Full-Stack & React Internals · Chapter 9 of 10 · ~15 min
Project: Interactive Kanban Board
Build a responsive Kanban workflow with optimistic updates, safe error rollback, bounded undo history, localStorage persistence, and keyboard-first controls.
- Apply optimistic UI updates with snapshot rollback
- Maintain a reactive immutable Undo stack
- Persist board state safely in localStorage
- Support full keyboard navigation and aria-live feedback
Project: Interactive Kanban Board: learn it visually
Build a local-first Kanban board with optimistic state updates, rollback on error, bounded undo history, localStorage persistence, and keyboard accessibility.
1Optimistic UI, Undo & Accessibility Architecture
Instant feedback makes apps feel fast, but optimistic updates must never lie when a network call fails or trap keyboard users.
Wrong idea: Mutate UI optimistically and ignore server errors
If the PATCH request fails, the card looks moved in the browser while the database still has the old column.
Real system: Snapshot previous state and roll back on failure
Save the prior snapshot before updating UI, then restore it cleanly and announce the error if the request rejects.
2Live Project Lab: Optimistic Kanban Board
Move cards across columns, test Undo, or toggle Simulate Next Save Error to watch automatic rollback in action.
Audit keyboard focus rings
Wire optimistic card move
Persist board to localStorage
Move a card with ← / →, test Undo, or simulate an API failure.
Predict first
What happens if you update localStorage before the API call resolves and the API returns HTTP 500?
renderBoard(nextBoard);
localStorage.setItem("board", JSON.stringify(nextBoard));
await saveToApi(cardId, nextCol); // throws 5003Bug Hunt · Optimistic Rollback
Fix moveCardOptimistic so a failed API save restores previous in both the UI and return value.
// Pattern: snapshot -> optimistic render -> persist or rollback🎯 Find and fix the bugs in the code above, then press Run & verify to test your solution.
Need a hint?
Inside catch (err), call renderBoard(previous); and return previous;.
4Knowledge Check
Why should optimistic updates capture an immutable snapshot before mutating UI state?
What makes a Kanban board accessible to keyboard-only and screen-reader users?
5Recap
- Snapshot & Rollback: Save prior state before optimistic renders and restore it on error.
- Reactive Undo: Keep a bounded immutable history array in React state.
- Keyboard Accessibility: Pair focusable move controls with
aria-livestatus updates.
Completed the Kanban lab and bug hunt?