Autosave
Save changes continuously without a Save button, while keeping users certain their work is safe.
8 states7 edge casesDesktop + Mobile
01The problem
Explicit Save buttons lose work when people forget them, close tabs or lose connection. Autosave removes that risk, but replaces it with uncertainty: users can no longer see when their work became safe, and failures that used to be loud become silent.
02When to use
Use when
- Long-form editing: documents, descriptions, notes, settings pages with many fields
- Editors where users work for minutes or hours in one session
- Drafts that should survive a closed tab or crashed browser
- Single-owner content, or collaborative content with clear conflict handling
Avoid when
- Changes trigger side effects — sending an email, charging a card, publishing to customers. Use an explicit action.
- A set of fields is only valid together, such as a billing address. Save the group on submit.
- Users expect to experiment and discard, such as a filter builder or a pricing calculator.
03Recommended UX
Statecraft recommendation
Save on a short debounce after the user stops typing, and show one persistent, quiet status indicator near the title: “Saving…”, “Saved”, or a clearly escalated failure. Never let a failed save look like a successful one.
A status indicator in a fixed location builds trust through consistency. Toasts for every save are noise; no indicator at all leaves users pressing Cmd+S out of anxiety.
The success state should be quiet and the failure state loud. The asymmetry is the point: users only need to act when saving fails.
Debouncing at around one second balances server load with the risk window. Also save immediately on blur and before navigation.
04Interaction flow
- 01
Clean
Content matches the last saved version.
- 02
User edits
Status changes to “Unsaved changes” only if save is delayed.
- 03
Debounce
~1s after the last keystroke, or immediately on blur.
- 04
Saving
Request in flight; further edits queue behind it.
- 05
Server responds
Version number checked to detect conflicts.
Result
- Saved
- Retrying
- Conflict
- Offline
05Desktop behaviour
On desktop the status lives in the page header beside the title, where users look when they wonder whether their work is safe.
Desktop rules
- Show a timestamp on hover or focus: “Saved at 14:32”.
- Treat Cmd/Ctrl+S as “save now” — flush the debounce and confirm. Users will press it regardless.
- Escalate failure from the indicator to an inline banner after the second failed retry.
- Warn on tab close only when there are genuinely unsaved changes.
06Mobile behaviour
Mobile adds unreliable connections and apps that are backgrounded without warning. Saving must be more eager and local persistence is essential.
Mobile rules
- Save on app background and on keyboard dismiss, not only on debounce.
- Persist drafts locally first, then sync. A backgrounded app can be killed at any moment.
- Keep the status compact in the top bar — an icon plus one word.
- Show offline state persistently, not as a toast that disappears.
07States
Saved
Quiet: “Saved” in muted text. Timestamp available on hover.
Unsaved changes
Shown only if a save is waiting for longer than a moment, e.g. while offline.
Saving
“Saving…” with a subtle spinner. Do not block typing.
Retrying
First failure retries automatically with backoff: “Couldn’t save. Retrying…”
Save failed
Retries exhausted. Banner with Retry and Copy content. Do not dismiss automatically.
Offline
“Offline — changes saved on this device.” Syncs automatically on reconnect.
Conflict
Someone else saved a newer version. Editing pauses until the user chooses.
Read only
Permission revoked mid-session. Inputs lock with an explanation; unsaved text stays copyable.
08Edge cases
EC-01
Navigating away mid-save
The user clicks a link while a save request is in flight.
Recommendation
Flush and await the pending save before navigating within the app. For tab close, use the browser's unload warning only if the save hasn't completed.
EC-02
Edit conflict
Two people edit the same record; the second save carries a stale version number.
Recommendation
Reject on the server, then show both versions: “Dana updated this 2 minutes ago.” Offer “Keep mine”, “Use theirs”, and a diff. Last-write-wins silently destroys work.
EC-03
Offline for a long time
The user edits on a flight for two hours.
Recommendation
Persist to local storage, keep editing enabled, and sync on reconnect with the same conflict check. Show the offline state for the whole time, not just once.
EC-04
Validation errors
The user empties a required field.
Recommendation
Don't save the invalid field, but keep saving the rest of the form. Show the field error inline and make the status read “Saved — 1 field needs attention”.
EC-05
Destructive edits
The user selects all text and deletes it, or removes a section.
Recommendation
Autosave it, but keep version history and offer Undo for a few seconds. Autosave without undo turns a slip into data loss.
EC-06
Server rejects the save permanently
A 4xx response — the record was deleted or permission was revoked.
Recommendation
Stop retrying, explain the cause and keep the user's content visible and copyable. Never discard text the user typed.
EC-07
Rapid typing on slow connections
Saves take longer than the debounce interval.
Recommendation
Allow one request in flight at a time and coalesce queued edits into the next save. Out-of-order responses must not overwrite newer content.
09Microcopy
Success
Avoid
“Your changes have been saved successfully!”
Prefer
“Saved”
In progress
Avoid
“Please wait…”
Prefer
“Saving…”
Failure
Avoid
“Error”
Prefer
“Couldn’t save. Retrying…”
Offline
Avoid
“No connection”
Prefer
“Offline — changes saved on this device”
Conflict
Avoid
“Version mismatch”
Prefer
“Dana edited this 2 minutes ago. Choose which version to keep.”
10Accessibility
- Put the status in a role="status" region, but only announce transitions to failure, offline and conflict — announcing every “Saved” is noise.
- Status must not rely on colour alone. Pair colour with text and an icon.
- Conflict resolution is a modal decision: move focus to it and make both options keyboard reachable.
- Locking inputs on permission loss must keep the content readable and selectable, not visually disabled to the point of low contrast.
11Developer notes
- 01
Use optimistic concurrency: send the version the client edited from and have the server reject stale writes with a 409.
- 02
Keep a single save queue per document: at most one request in flight, with the latest pending state coalesced behind it.
- 03
Write to local storage (or IndexedDB) before the network request so a crash or kill loses nothing.
- 04
Track dirty state by comparing against the last confirmed server version, not the last sent version.
- 05
Retry transient failures (network, 5xx) with exponential backoff; do not retry 4xx.
12Implementation prompt
For Claude Code, Codex or Cursor
Implement autosave for the existing form/editor. Requirements: - Debounced save ~1s after the last change; immediate save on blur, Cmd/Ctrl+S and before in-app navigation. - Single save queue per document: one request in flight, later changes coalesced into the next request. - Persist pending changes to local storage before sending, and restore them on reload. - Persistent status indicator next to the title: Saved, Saving…, Retrying…, Save failed, Offline, Conflict. - Show "Saved at HH:MM" on hover/focus of the indicator. - Retry network and 5xx failures with exponential backoff; after exhausting retries, show a banner with Retry and Copy content. - Do not retry 4xx. Explain the cause and keep content visible and copyable. - Optimistic concurrency: send the base version; on 409, pause editing and show a conflict resolver (Keep mine / Use theirs / view diff). - Offline: keep editing enabled, show the offline state persistently, sync on reconnect. - Skip saving fields that fail validation but save the rest; show inline field errors. - Browser unload warning only when there are unsaved changes. - Announce failure, offline and conflict via role="status"; do not announce routine saves. Do not redesign the existing interface. Keep the save engine independent of UI components.
React + TypeScript reference code for this pattern — logic, hook, component and tests — is included in Statecraft Pro.