Loading, empty & error

Loading, empty, failed and loaded each look different and say so. Nobody should have to guess which one a blank area is.

Every surface that loads has four states, and each one looks like itself: a skeleton while it loads, a sentence and a next step when it is empty, the error and a retry when it failed, and then the content.

Step through the tabs: the skeleton has the rows' shape, the empty list says what a note is and offers New note, and the failure names what failed. Press Retry there: it is disabled while the read runs, and the notes arrive.

Do and don't#

Do

Draw a Skeleton in the shape of the content that is coming, so the page does not jump when it arrives.

Loading…
Don't

Cover the whole page with a spinner while one list loads: everything else on it was already usable.

No notes yet

A note is markdown, kept in this tab. Start one with a # heading.

Do

Say what would be here and how to get some: "No notes yet", a line on what a note is, and a New note button.

No data

Don't

Leave "No data" in an empty box. It reads the same as a failed load or a filter that hides everything.

The states#

StateShowComponent
Loading, first timePlaceholders in the shape of the contentSkeleton
Loading, short (under about 500ms)Nothing new: the skeleton waits that long before it fades in, so a fast load does not flashDelayedSkeleton
Loaded, nothing thereWhat would be here, why it is empty, and the action that fills itEmptyState
Loaded, nothing matches a filterThat the filter hid everything, and a way to clear itEmptyState
Loaded, but not set up yetWhat is missing, and the action that sets it upEmptyState
No permission to see itWhat is held back, and how to get access when there is a wayEmptyState
Failed, nothing to show, in a line or a listThe error, the server's own words in detail, and RetryLoadFailure
Failed, nothing to show, filling a pane or a pageWhat failed as the title, the server's own words below it, and RetryLoadFailure with orientation
Refresh failed, older data still shownThat the data is stale, the server's own words in detail, and RetryRefreshFailure
Loading more of a listA Load more button that turns into its own failure and retryLoadMoreFooter with usePagedAppend

Retry design

The fetch task gives up on the first network error, and most of the failures in CI last week were a single dropped connection.

The first note answers in 0.2 s, before its skeleton would show: the pane is blank that long, then holds the note. The second takes 2 s: its skeleton fades in after 500ms and holds the note's place until it arrives. The wait is DelayedSkeleton's own: the Skeletons inside it are laid out as the note will be, and nothing times them.

When one skeleton gives way to another for the same wait, as a route's does to the page's own once the page has mounted, wrap the place in a DelayedSkeletonProvider. The page's skeleton then carries on the route's wait: it fades in once, and one already shown stays shown, rather than blinking out and waiting all over again.

An empty state that comes from a filter is not the same as an empty list. "No notes yet" invites writing one; "No notes match" invites clearing the filter.

  • Job statesProjects
  • Oct 28Journal
  • Oct 24Journal

Add #release to #ci: no note has both, and the list says so with Clear filter rather than "No notes yet".

Filling the space or sharing it#

An EmptyState that is the only thing in its pane, list or page stands vertical, centred in the space. One that shares its space with other content, such as a section of a settings page, a sidebar group or a card among other cards, lies on one row with orientation="horizontal", so it takes no more height than the content it stands in for.

An icon and a title are a whole empty state. Add the description only when the title leaves the reader asking why, and the action only when there is a next step.

Deploy keys

Only maintainers see deploy keys

Tokens

No tokens yet

A token lets a script act as you.

Webhooks

Couldn't load webhooks

503 Service Unavailable

The failed section is a LoadFailure with orientation="horizontal": it keeps the same row as the empty ones and says what failed in its title. The red is not what tells it apart from the empty sections: the title and Retry do that.

Inbox3 of 40
  • AliceTouch sizes for the toolbar icons
  • bot-oneRelease 0.9.0: changelog draft
  • CIFlaky test: retry-once times out on the slow runner

Press Refresh: the first one fails, and the conversations already shown stay under the warning. Press Load more twice: the second page fails in place of the button, and its Retry loads only that page.

Files a document names#

A file that a document links or embeds looks one way while the app looks it up, another when there is no such file, and another once it was deleted, so the reader knows before clicking whether it will open.

Press Reload and the note asks for its files again. The links are chips at once; the picture, the card's lines and the comparison's sides show their placeholders a moment later. Then the answers arrive: the files that exist draw, the old plan is not found, and the first logo says it was deleted.

The app's lookupA linkA pictureAn embedded file
Still runningThe chip it will be, a plain link to the addressNothing at first, then PendingAttachmentMarkThe card, named by the address, over ContentLoading
FoundAttachmentLink, which opens the viewerThe pictureThe card, its size and its contents
No such fileMissingAttachmentMarkMissingAttachmentMarkMissingAttachmentMark
DeletedDeletedAttachmentMarkDeletedAttachmentMarkDeletedAttachmentMark

A file found to be one no renderer draws in a document, such as a PDF behind an address whose name reads like a picture or a text file, is an AttachmentLink wherever it was embedded, never a broken picture.

A link is the same chip whether the lookup has answered or not; only what a click does changes, so nothing on the line moves when the answer comes. A picture and a card's body wait as Loading, short says above: a lookup that answers quickly never shows a placeholder. Looking a file up, fetching the renderer that draws it and reading its text are one wait to the reader, so a card draws the same lines for all three, and they fade in once, however the wait passes from one to the next.

An app tells the plugins what it knows through useSource, beside the resolve that reads the address:

  • While the lookup runs, return undefined.
  • Return null only when the app knows there is no such file. A file the reader may not see, or one in another place the app does not look, is not a missing file.
  • When the lookup fails, or there is nothing more to know, return the source useSource was handed: the file is drawn as its address says, and an address that works keeps working.
  • Give a text file its size. A card does not load text of unknown size until the reader asks.

Retrying#

A failure does not recover by itself, so its way out is a control, not a promise to try again later. Retry reruns only the read that failed, and is disabled while it runs. When an overlay opened from a failed surface closes, send focus to its Retry through retryRef: the overlay's own trigger may be gone. LoadFailure wires both in every orientation, so a failure that fills a pane is a LoadFailure too, not an EmptyState with a Retry of its own.

A renderer whose code does not arrive (the reader went offline, or a new release replaced the chunk an open page asked for) is one such failure: a LoadFailure takes its place, and under it the text stays readable as written, or the file stays a download link, so the content is never lost behind the failure.

On each platform#

Desktop & pointer#

  • Keep what loaded already in place while the next page or a refresh loads; replace only what changed.
  • A failure on one line (LoadFailure, RefreshFailure, the Load more footer's) puts the raw error in its title, so hovering it shows the detail.

Touch#

  • Hover shows nothing on a phone, so an error message names what failed in words, not only in a tooltip.
  • Prefer a Load more button at the end of a list to loading on scroll alone: a thumb flicking past the end should not start requests it did not ask for, and a failure needs a place to sit.

In the demos