Revalidate() a Page for SSG like Next.js - Invalidate Sanity CDN Cache
Last updated: Jul 20, 2022
nextjs has this cool new feature to revalidate() a page for SSG, which makes it possible to update a single page once the data has changed. So I'm wondering if there is some way to invalidate the sanity CDN cache? Currently, if I have useCdn set to true, the revalidate() option in nextjs just pulls the stale data, currently I can't use the cdn at all because of this limitation.
Jul 20, 2022, 3:41 PM
Hmm, maybe using the CDN is just a bad idea for SSG.
Jul 20, 2022, 3:47 PM
and I discussed it at length in the recent past and our general recommendation is that you shouldn’t use the Sanity CDN in a Next.js setup which uses dynamic revalidation.
Jul 20, 2022, 7:58 PM
! The cache invalidates any time you publish an edit to a non-draft document, so editing/publishing the new content you're trying to pick up with your