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.
Parameters
Section titled “Parameters”clientUrl
Section titled “clientUrl”string | undefined
What resolveLivePreviewUrl produced, if anything.
debounceMs?
Section titled “debounceMs?”number
Resolved sync debounce.
documentId?
Section titled “documentId?”string
The saved document id, absent while it is being created.
formValues
Section titled “formValues”Record<string, unknown>
The form’s current values.
initialUrl?
Section titled “initialUrl?”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.
tempId?
Section titled “tempId?”string
The client-generated temp id for an unsaved document.
LivePreviewUrl | undefined
The configured url in any of its three forms.
Returns
Section titled “Returns”string | undefined
The preview URL to load, or undefined while nothing can be resolved.