Hey,
I’ve got a NextJS site which I’ve built, it’s using StoryBlok as a headless CMS, and using the Storyblok-Javascript-Client to handle requests.
GitHub: GitHub - geometricpanda/geometricpanda-blog
Netlify Domain: https://geometricpanda-blog.netlify.app/
When publishing a change in StoryBlok i’m not seeing it reflected on the site at run-time, so i started debugging it.
I’m aware for local NextJS development that StoryBlok caches content, so I created an API endpoint which tells StoryBlok to purge it’s cache: geometricpanda-blog/revalidate.ts at main · geometricpanda/geometricpanda-blog · GitHub
Next within that endpoint I’ve also told NextJS to revalidate that path.
I’ve then hooked up Storyblok webhooks to that revalidate api and made a change to the content (Storyblok passes the changed content ID via the webook).
But it’s not updating on the site which leads me to believe that this is a Netlify cache causing this.
I know I could trigger a complete cache purge programatically to resolve this, and indeed it does update when i do this, but it’d be much better for my use-case if i could selectively purge the single page cache.
Taking this a step further is the NextJS preview mode with res.setPreviewData({});
in a preview API, as documented here: Advanced Features: Preview Mode | Next.js
Unfortunately this was also suffering from the same problem of the cache not refreshing.
So i guess what i’m asking is:
- Is there a way to selectively purge URL caches? such as curl -x PURGE (or similar)
- Is there a way to get Netlify to respect the preview mode header?
thanks