contentful / live-preview

Preview SDK for both the field tagging connection + live content updates
https://www.contentful.com/developers/docs/tutorials/general/live-preview/
MIT License
64 stars 14 forks source link

Nextjs 14 live preview #589

Closed sayjeyhi closed 5 months ago

sayjeyhi commented 7 months ago

Hi

I have a question, why we can't use lazy and Suspense to import live preview in nextjs14? instead of having vite and extra build step...

bluebeel commented 6 months ago

I made this:

'use client';

import { ContentfulLivePreview } from '@contentful/live-preview';

ContentfulLivePreview.init({
  locale: 'en-US',
  debugMode: true,
  enableLiveUpdates: true,
});

export default function LivePreview() {
  return null;
}

and usage in your component:

{isEnabled && <LivePreview />}
ghost commented 6 months ago

I am getting this error, Error: Live updates are not initialized, please call ContentfulLivePreview.init() first.

Any ideas guys ? @sayjeyhi @bluebeel

Screenshot 2024-04-04 at 2 34 36 PM

bluebeel commented 6 months ago

Without any piece of code, I cannot tell you anything