Skip to content

useLivePreviewServerUrl

useLivePreviewServerUrl(props): string | undefined

Defined in: packages/react/src/livePreview/useLivePreviewServerUrl.ts:38

Resolves the preview URL for a { server } resolver, which the browser cannot evaluate itself because it reads the database.

Only the { server } form issues a query. A string or client resolver was already resolved synchronously by resolveLivePreviewUrl, so this returns that URL untouched and Convex is never called — the round trip is opt-in by the shape of the config, not a cost every project pays.

Values are debounced on the same cadence as useLivePreviewSync: the URL is a function of unsaved form state, so it would otherwise re-query on every keystroke.

string | undefined

What resolveLivePreviewUrl produced, if anything.

number

Resolved sync debounce.

string

The saved document id, absent while it is being created.

Record<string, unknown>

The form’s current values.

string

The URL NextAdminPage resolved server-side, used until the first query answers so the iframe’s first paint needs no round trip.

"collection" | "global"

Whether slug names a collection or a global.

string

The collection or global being previewed.

string

The client-generated temp id for an unsaved document.

LivePreviewUrl | undefined

The configured url in any of its three forms.

string | undefined

The preview URL to load, or undefined while nothing can be resolved.