Learning on Web Dev Open is free for all.

Framework Internals > The App Router, and where the seams areError and loading states are the design
Phase 04The App Router, and where the seams are228 of 434

Error and loading states are the design

Users spend a meaningful fraction of their time in these states and they are usually specified by nobody.

Concept14 minAI pair

Empty, loading, partial, error, offline, forbidden, and the one with four thousand rows. Every one of those is a screen someone will see, and in most projects the mockups cover exactly one of them. The states are not edge cases, they are a majority of the states in which your interface exists on a bad connection.

A loading state should occupy the same space as the content it replaces. A skeleton with the right dimensions means nothing moves when the data lands, and nothing moving means nobody misses a tap. A spinner in the centre of an empty box means the entire page jumps when it resolves, which is worse than showing nothing at all.

An error state has one job: say what happened and what to do next. "Something went wrong" achieves neither. "We could not load your invoices: retry, or contact support with reference 4f2a" gives an action and a thread to pull. And it needs to be recoverable in place: an error boundary with a reset that retries the segment beats one that only offers a full reload.

You should now be able to

  • Design a loading state that does not shift the layout
  • Write an error state that tells someone what to do next
Ask the community

Loading…