mid · lesson 2 of 7

Designing for failure

Offline, timeouts, partial data, retries.

Sidhanshu Monga·1 min·
You’ll be able to
  1. List the ways a screen can fail and design each one
  2. Keep users' work safe when the network isn't
  3. Retry without making things worse

Networks drop, servers time out and data arrives half-complete. Users on trains, in lifts and on cheap mobile plans see these states every day. Designing for failure means deciding what they should see and do when it happens.

The failure list

For any screen, walk through:

  • Slow — a request takes 5 or 10 seconds
  • Failed — a request returns an error
  • Offline — the connection drops mid-task
  • Partial — some data loaded, some didn't
  • Stale — the data shown is out of date

Each needs a design, even if the design is "show the cached version with a note".

Keep the user's work

The worst failure is losing input. Save drafts locally, keep form values after an error, and queue changes made offline so they sync later. Saving in the background, and saying so quietly, removes the fear of losing work:

time
Debounced autosave
Save after the typing stops, not on every keystroke, and say so quietly. A save button makes the user responsible for not losing their own work.
Saved
#debounce#status
Save after the typing stops, and say so quietly.

Retry carefully

Retry transient failures automatically with increasing delays (exponential backoff) so you don't hammer a struggling server. Make retried actions idempotent, so that retrying a payment or a message can't do it twice. When automatic retries give up, offer a clear manual retry.

Communicate calmly

Say what happened, what still works, and what will happen next: "You're offline. Changes will sync when you reconnect." Avoid alarming language for temporary problems, and don't block the whole screen for a failure in one part of it.

Try it

Open your product with DevTools throttled to "Slow 3G", then switch to "Offline" halfway through a task. Write down everything that broke, lost data or left you without feedback, and fix the worst one.

This lesson needs a hands-on exercise. The idea is sketched in issue #69. Build it and it ships here, with your name on it.
Key takeaways
01Failure states are part of the design, not edge cases
02Never lose what the user typed
03Say what still works, not just what doesn't