- add dependency - configure in for - add client utility to refresh Next routes on live updates - mount live preview refresh bridge in frontend layout - enable drafts/autosave/schedule publish for global - regenerate and update lockfile
10 lines
360 B
TypeScript
10 lines
360 B
TypeScript
'use client'
|
|
import { RefreshRouteOnSave as PayloadLivePreview } from '@payloadcms/live-preview-react'
|
|
import { useRouter } from 'next/navigation.js'
|
|
import React from 'react'
|
|
|
|
export const RefreshRouteOnSave: React.FC = () => {
|
|
const router = useRouter()
|
|
|
|
return <PayloadLivePreview refresh={() => router.refresh()} serverURL="http://localhost:3000" />
|
|
}
|