ndimatteo / HULL

💀 Headless Shopify Starter – powered by Next.js + Sanity.io
https://hull.dev
MIT License
1.36k stars 167 forks source link

Question About PreviewAction #97

Closed 3200pro closed 2 years ago

3200pro commented 2 years ago

Hi Nick,

I'm working on integrating a draft preview. Typically I integrate something similar to this walkthrough: https://www.sanity.io/guides/nextjs-live-preview

I've got preview working using your PreviewAction found in resolve-actions.js rather than the guides method for previewing content however it's not hot reloading. In order to see a fresh preview of the content, I need to do a browser reload of the preview page. Is this intended or what am I missing?

Thanks for all the awesome work on this! Super well done:)

ndimatteo commented 2 years ago

Hey there,

Yes, this is the intended behavior! The preview included in HULL is not using next-sanity's createPreviewSubscriptionHook which is what streams updates in real-time.

In HULL, we are simply leveraging Next.js preview mode to fetch drafts instead of the published version, which requires a refresh as you make changes in Sanity.