I've got a kind of complicated slideshow component set up for my homepage which uses individual slices depending on what the user has selected. Unfortunately this means I can't use the on the frontend of my site, but I'd still like the content editor to get a preview of the image they've added in the Page Builder.
Is there a way to detect whether the user is viewing the site through the Page Builder, or through the live site (if that makes sense?).
Essentially, I'm hoping to do something like this:
{isPageBuilderPreview ? (
<SliceZone... />
) : (
)}
So the Page Builder view gets served the and the normal user on the website gets served the .
I'm running Next.js 14.1.3, but happy to upgrade to the latest version if needs be.
I think I've realised what my issue was – I wasn't fully understanding how the component worked. I thought it had to be present on the page.tsx file for the Page Builder / Live Preview to work. But I've just tried out a different approach and realised the slices are rendering in the Live Preview just fine.