Edits are kept and retried when saving fails

Published: September 29, 2026

v3.7.0

Until this release, the document store reverted local edits whenever saving them failed, whatever the cause. An expired session, a server error, or a dropped connection discarded what the user had typed, and editors that don't handle the reverted event, such as @portabletext/plugin-sdk-value, lost the text with no error. The store now keeps those edits and resubmits them until they save.

The change is in @sanity/sdk and applies to @sanity/sdk-react apps as well. No code changes are needed.

Which failures are retried

The store retries a save that fails with a 401 (for example, an expired session), a 408, 429, or 5xx response, a 409 transaction conflict from contention while committing, or a dropped connection. It resubmits the same transaction with exponential backoff, up to 10 seconds between attempts. When the credentials change, it retries right away, so edits made while a session was expired save as soon as the user signs back in.

Transactions the server rejects, such as a 400, a 403, or a revision conflict, are still reverted.

Show pending saves in your app

While a retry is pending, useDocumentSyncStatus returns false for the document, so a sync indicator keeps showing unsaved changes until the save succeeds. Each failed attempt also emits a new submission-failed document event with the error and the attempt number. Listen for it with useDocumentEvent to tell users why their changes haven't saved yet:

Pending edits are held in memory, so they are lost if the page reloads before a retry succeeds.

Related documentation

Loading...