Skip to content

LivePreviewProvider

LivePreviewProvider(props): Element

Defined in: packages/react/src/livePreview/LivePreviewContext.tsx:97

Mounts the live-preview listener (both postMessage and BroadcastChannel) for the subtree it wraps, once useLivePreviewEnabled confirms both the query param and the session-verified marker cookie are present. Otherwise it renders children untouched, at zero cost.

Renders no visual affordance either way: the admin panel frames the preview and owns its controls.

Always mounted by the caller (NextLivePreviewProvider in @vexcms/next); no project writes the gating logic itself.

Everything it needs comes from VexConfigContext — allowedOrigins to screen postMessage frames, and collections/globals both to validate an incoming payload against the target’s generated Zod schema and to tell which kind of resource a slug addresses. Passing those as props would be a second provenance for config that can disagree with the first.

ReactNode

The subtree that may call useLivePreview.

Element

children, wrapped in the overlay context when preview mode is on.