Hi Payload! Working on setting up live preview :)
I am getting a handful of errors at the moment.
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:3000') does not match the recipient window's origin ('http://localhost:3030').
My frontend is running at localhost:3000, and my CMS is running at localhost:3030.
In my payload.config.ts I have set CORS and CSRF like so:
csrf: ['http://localhost:3000', 'http://localhost:3030'],```
In my frontend (NextJS App router application), I have a page.tsx at a dynamic route ```[[...slug]]``` that fetches the page from the CMS, and then passes that to a client component that looks like this:
```'use client';
import { useLivePreview } from '@payloadcms/live-preview-react';
const ClientPage = ({ page, article, locale, slug }: { page: any; article: any; locale: string; slug: any }) => {
const { data } = useLivePreview<any>({
initialData: page,
serverURL: process.env.CMS_URL_DEV!,
depth: 0,
});
console.log(data.docs[0].layout);
if(data){
return(
<div>{data.docs[0].layout[0].content.title}</div>
)
}
};
export default ClientPage;
I am also receiving an error/warning stating;
Warning: Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?
This warning appears on the line where I try to render the data's content in the <div> in the ClientPage-component.
Any help with any of these errors is appreciated :)


