Skip to content

useLivePreviewSync

useLivePreviewSync(props): void

Defined in: packages/react/src/livePreview/useLivePreviewSync.ts:35

Posts the form’s complete current values to the active preview target, on both BroadcastChannel and (when a window reference is held) postMessage, on every change, debounced. Also listens for a matching vex-live-preview-handshake over BroadcastChannel and replies immediately with the current values — recovering state for a tab this admin session never opened itself.

string

The collection or global slug being previewed.

number

Milliseconds to wait after the last form change before posting. Defaults to DEFAULT_LIVE_PREVIEW_DEBOUNCE_MS.

string

The saved document id, once it exists.

AnyFormApi

The edit view’s form instance.

Window | null

A preview surface this panel holds a reference to — in practice the embedded iframe’s contentWindow, or null. A tab opened from the preview link leaves no reference, so it is reached over BroadcastChannel: postMessage no-ops without a window, the broadcast posts regardless.

string

The client-generated temp id, before the first save.

void