Skip to content

DocumentEditRuntimeState

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:13

View-local UI state useVexDocument deliberately excludes (S5, decision 18): which history version is being previewed, how to re-point the view at a new row id after a mutation returns one, how to settle the form once a save round-trips, and the live-preview panel’s open state. One instance per mounted edit view — CollectionEditForm/GlobalEditView own the real state and pass it down as value; built-ins only ever read it.

optional livePreview?: object

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:27

Live-preview panel state for this resource, or undefined when no livePreview config resolves.

isOpen: boolean

isSplit: boolean

toggle: () => void

void


optional onDocumentIdChange?: (id) => void

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:23

Re-points the view at a different row id — called after saveDraft/publish returns one (the first draft save on a published document bootstraps a new row). Omitted for a global, which has no separate row id to re-point.

string

void


onSaved: (changes) => void

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:25

Defers the form’s post-save reset until the live row reflects the write — see useResetWhenSaved.

Record<string, unknown>

void


onViewVersion: (view) => void

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:17

Shows a version’s snapshot in the form, or null to return to the live document. Never saves.

ViewedVersion | null

void


viewedVersion: ViewedVersion | null

Defined in: packages/react/src/documents/DocumentEditRuntimeContext.tsx:15

The history version currently shown in the form, or null for the live document.