Raft 设计系统

模式

Freshness

How a page stays right after the app was in the background, offline or disconnected — one signal that checks again, content that stays while it does, progress only when someone waits, saying "may be out of date" instead of pretending, when an update is announced, and what each kind of component is responsible for.

本页尚未翻译
译文完成之前,这里显示英文原文。 阅读英文版

What people see should be true. When the product isn't sure it is, it checks by itself, and the check doesn't get in the way.

Realtime updates keep Raft's pages current (Navigation), but while the app is in the background, the phone is locked, the network is gone or a browser tab sleeps, some updates are always missed. This page says how the product catches up, how the screen behaves while it does, and what each kind of component owes. It is the other half of Refreshing: a page fed by realtime updates has no pull to refresh, so it has to catch up on its own (artin, 2026-11-19, #proj-mobile:#198; draft and survey of the mobile app by Lagoon).

Apple, Android and HarmonyOS say the same: show what you have at once and fetch the new in the background (Apple HIG, Loading), come back to the state people left (Apple HIG, Launching; Android, Save UI states), don't hide old data behind a placeholder (Apple HIG, Widgets), and while a view can't be seen, only note that it is owed an update, then update it once it shows (HarmonyOS, passive refresh of widgets). Android also lets people pull to refresh pages that update by themselves; Raft doesn't, on purpose (Refreshing).

When it applies

Every platform: web, desktop, iOS and Android. Each rule names the moment it applies to on the web as well as in the apps, since the design system is shared.

Rules

Coming back checks once

  • When the app comes back to the foreground, the realtime connection is joined again, the network returns or the computer wakes, check what is on screen again, once. On the web the same moments are the tab becoming visible, the window taking focus, online and a page restored from the back-forward cache.
  • One coming back is one check: the events that arrive together (foreground, then reconnect, then online) are merged into one. A return while the connection never dropped, less than a minute after the last check, needs none: on a desktop the window takes focus every time someone switches to it, and checking each time would be work for nothing.
  • One signal. Pages and cards don't each listen to the app's lifecycle: the owner of the data subscribes to one "came back" signal, so every place catches up the same way and none is forgotten.
  • Check what is on screen and what will show at once (the page Back returns to, badges, widgets). A page that can't be seen only notes that it is owed a check, and is checked when it shows.
  • After 15 minutes locked, during which Vault changed an approval card to "Approved by Alice", unlocking the phone shows the card approved within a second, with nothing for the person to do.

Content stays while it updates

  • Keep what is on screen and replace it in place when the new data arrives. Don't go back to a skeleton or "Loading…", and don't empty a list to fill it again.
  • Keep the scroll position, what is expanded, drafts and filters: the person comes back to the page they left, then it updates.
  • When the check fails, keep the content, never an error page. A check the product started fails silently and is tried at the next coming back; a refresh the person asked for shows the warning toast of Refreshing. If it keeps failing, say so where the data is (Not sure, say so).
  • The server's copy wins when it is not older than the one on screen (by revision, update time or sequence). Don't keep "the copy already loaded" and add exceptions field by field.

Progress only when someone waits

SituationShow
First visit, nothing to show yetA skeleton, after 1 second (Feedback)
The person asked: a pull, Retry, a button that reads againThat control's own progress: the pull's indicator, the button's loading
The product checks again on its ownNothing

A spinner or pull indicator that turns every time the app comes back says "this page can't be trusted until it stops", the opposite of what Refreshing promises. The Computers page in the mobile app used to turn both on every return; it now checks silently.

Not sure, say so

  • When data may be out of date and can't be confirmed now (offline, the server says it is serving a stale copy, the check has failed several times), say so on one line in foreground-hint where the data is: "Updated 10 min ago" or "May be out of date". It is not an error, so not orange. A computer whose data is past staleAfter already shows this way (Computers).
  • Put the line with the data it is about: under a card, at the top of a list, in a widget's corner. Not a banner across the app: what is out of date is that data, and the line next to it says which.
  • Something with an expiry (a card button's signed handle, an action card's expiresAt, a QR code, an invite link) checks its age before it is used and quietly reads itself again when it has expired, then acts. The person never sees the expiry error first.
  • Never show "couldn't read" as "nothing": no "0 unread" and no empty list when the read failed (Feedback).

When an update is announced

  • By default it isn't: changing in place is the announcement. At most one fade, as Motion allows for a change of state.
  • Announce it only when:
    1. It changes what the person is about to act on. If a card turns "Approved by Alice" while the person is about to press Approve, the button goes and the card says why; nothing changes under the finger without a word.
    2. It arrives out of view while the person reads further up: it moves nothing in view, and the count shows on the way to it, "3 new messages" on Back to bottom (Conversation).
    3. The object has its own mark for a change, such as a channel's announcement strip going bold until each person opens it (Channel).
  • Never a toast saying a refresh finished.

Reconnecting

  • When the connection drops, leave the screen as it is; don't gray it out. Most drops come back within seconds, unseen. Only when it stays down for more than 5 seconds and the person is doing something that needs it, say so there.
  • In a conversation that is one line above the composer, "Reconnecting…", the same line as for an agent that can't reply (Identity and presence), and in its place while it shows: until the connection is back, no message reaches the agent either, so one line says the one thing that is true. The strip offering to add someone a sent message mentioned (Conversation) is about that message, and stays above both.
  • Once reconnected, run the same check as coming back. Retry with backoff and jitter so that many clients coming back together don't flood the server.

What each kind of component owes

The more directly people act on something, the fresher it must be; a summary may lag a little, but never contradict what it summarizes.

ComponentWhat it isWhat it owes
Card in a message (an App card, an action card)A live object people act onChanges in place with the object. Its buttons work only while their credentials are valid, and check them first. After acting it shows the object's new state. It is never older than the messages around it
Row in a list (Home, Activity, a task)A summary of an object and the way into itAgrees with what opens: a row never says the opposite of the page behind it. A few seconds' lag is fine; after coming back, none
Page header (channel, task, agent)Who or what this is, and its key stateNames and avatars may be cached. The key state (a task's status, an agent's or computer's state) is checked on coming back: people decide whether to act from it
Timeline (channel, thread, DM)Events in order, whose messages may change in placeAppends what is new and replaces what changed. Coming back catches up both: new messages, and changed ones (cards, deletions, reactions, reply counts)
Badge or countA number that sums up a listComes from the same source as its list and changes with it: a list read while its badge still counts it is a bug
Snapshot page (Saved, search results)A list read once when it opensNot live; has pull to refresh (Refreshing)
Widget, notificationA summary outside the appShows old data with its time rather than a placeholder, and updates when the app has checked

Don't

  • Don't add pull to refresh or a Refresh button to a live page to cover for missed updates.
  • Don't give each card or page its own lifecycle listener.
  • Don't reload the whole page, scroll to the top or close what was open when the app comes back.
  • Don't poll instead of checking on coming back. Poll only facts whose updates aren't reliable (such as an agent's state), and only in the foreground.

Open

Both are listed in Open questions, with the default to use until they are settled.

  • How old data has to be before a failed check says "may be out of date": one threshold, or one per kind (state 30 seconds, lists 60, cards 5 minutes). Until settled: 60 seconds since the last check that succeeded, for everything.
  • Whether hosted pages (Artifacts, App pages) are asked to check again when they become visible, in the App developer guide. Until settled: not asked; Raft checks the card and the frame around them.