If your frontend supports Server Components, use server-side Live Preview.
window.postMessage event whenever document form state changes. Your front-end application listens for these events and re-renders with the latest data.
FrogBot provides useLivePreview integrations for React and Vue. Other frameworks can use the framework-independent package described in Building your own hook.
useLivePreview accepts these options:
The hooks return
data, the latest populated document, and isLoading, which is true until the first update arrives. The Vue composable returns both as refs.
Guard against required fields being removed while editing. Use conditional rendering, optional chaining, or defaults instead of assuming nested data always exists.
The hook’s
depth must exactly match the depth of the initial request. See Depth.Frameworks
React
Vue
Building your own hook
subscribe accepts these options:
Each call to
subscribe resets the merged data cached by an earlier subscription, so a new page doesn’t inherit the previous page’s changes.
Custom population requests
Each update is sent back to your FrogBot server so relationships and uploads can be populated todepth. Pass requestHandler to change how that request is made. It must return a Response whose JSON body is the populated document.
Troubleshooting
Relationships or uploads are not populated
When the frontend and FrogBot server use different domains, ports, or subdomains, configure CORS. If protected resources require cookies, also configure CSRF.Relationships or uploads disappear after editing
Ensure the initial request anduseLivePreview use the same depth:
Iframe refuses to connect
If your frontend’s Content Security Policy prevents the Admin Panel from embedding it, allow the Admin Panel domain withframe-ancestors: