Gold upgrade planned

Available to study now. Gold Edition improvements will be added one chapter at a time.

Chapter 9 of 10
Course Progress0 of 10 completed (0%)

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.

Project: Interactive Kanban BoardBuild a local-first Kanban board with optimistic state updates, rollback on error, bounded undo history, localStorage persistence, and keyboard accessibility.UNDERSTANDProjectFOLLOW THE FLOWKanban BoardAPPLY ITlocal-first KanbanboardProject: Interactive Kanban BoardBuild a local-first Kanban board with optimistic state updates, rollback on error, bounded undo history, localStorage persistence, and keyboard accessibility.UNDERSTANDProjectFOLLOW THE FLOWKanban BoardAPPLY ITlocal-first Kanbanboard

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

UI: Done · Server: 500 Error
Silent state drift on refresh!

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

Snapshot → Optimistic UI → 500 → Rollback
UI and server stay truthful

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.

Live Project · Optimistic Kanban Board
To Do
1

Audit keyboard focus rings

In Progress
1

Wire optimistic card move

Done
1

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 500

3Bug 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
Bug Hunt · kanbanOptimistic.ts
TypeScript

🎯 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

Concept Check 1 of 2
1

Why should optimistic updates capture an immutable snapshot before mutating UI state?

Concept Check 2 of 2
2

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-live status updates.

Completed the Kanban lab and bug hunt?

Enjoying this free lesson? Your support helps us build more free animated chapters.

Support Us