When I use contentful preview SDK with nextjs 14, and I lazy load the preview SDK using lazy and Suspense it gives me this error, any idea where should I call it to preview this error?
Preview.ts:
import { ContentfulLivePreview } from '@contentful/live-preview';
ContentfulLivePreview.init({
debugMode: true,
enableLiveUpdates: true,
locale: 'en-US',
});
ContentfulLivePreview.subscribe('save', {
callback: () => {
const pathname = window.location.pathname;
return fetch(`/api/revalidate?pathname=${pathname}`);
},
});
Layout:
<BrandProvider>
<Suspense fallback={null}>{isEnabled && <Preview />}</Suspense>
{header}
<div className="flex-1" data-testid="body-content">
{children}
</div>
{footer}
</BrandProvider>