Preserve operations for collaborative document edits
Published: July 16, 2026
This release adds an opt-in way to send and receive patch operations directly, so collaborative editors, starting with Portable Text, don't lose edits when two clients change the same field at once. This is a core @sanity/sdk change. If you use @sanity/sdk-react, nothing changes for you here.
Send patches without diffing
Pass preserveOperations: true to editDocument() to forward your patches to the server as-is, instead of re-deriving them from a diff. Keyed array operations stay addressable, so concurrent edits interleave instead of overwriting each other.
import {editDocument} from '@sanity/sdk'
editDocument(doc, patches, {preserveOperations: true})Existing calls to editDocument() are unaffected.
On the read side, applyRemoteDocument now emits a remote-patches event with the transaction's patches and an origin of 'local' or 'remote'. If a preserved patch can't reapply during a rebase, the transaction is skipped and surfaced as a rebase-error event instead of failing the store.