You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Headless CMS and SSG + on demand revalidation
Next.js app is built and all existing pages are rendered and served - all good
In headless CMS new page with path "/testpage1" is created
Headless CMS calls next.js app's hook that calls revalidate("/testpage1")
New page "/testpage1" is rendered and visible - perfect
Page is deleted from Headless CMS, that calls revalidate hook again
Page "/testpage1" still is served by next.js app - not expected
I'm using pages and in getStaticProps () I return { notFound: true, revalidate: 5 } when trying to fetch data for the page from Headless CMS that doesn't exist.
For other pages that don't exist, app is returning 404 - that is correct. However, deleting the existing page and calling revalidate() doesn't purge the cache, and the page is still visible.
I'm not 100% sure it is related to cache handler but to the logic on next.js side that decides when to re-render specific page. Given the fact that revalidate() eventually calls cache handler's revalidateTag it should trigger rerendering the page and return 404 if { notFound: true, revalidate: 5 } is returned by getStaticProps(), no? Or am I missing something?
P.S. With NEXT_PRIVATE_DEBUG_CACHE set to true I don't see any output of revalidateTag, so not sure that revalidateTag is triggered during on demand revalidation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Scenario:
I'm using pages and in getStaticProps () I return
{ notFound: true, revalidate: 5 }
when trying to fetch data for the page from Headless CMS that doesn't exist.For other pages that don't exist, app is returning 404 - that is correct. However, deleting the existing page and calling revalidate() doesn't purge the cache, and the page is still visible.
I'm not 100% sure it is related to cache handler but to the logic on next.js side that decides when to re-render specific page. Given the fact that revalidate() eventually calls cache handler's revalidateTag it should trigger rerendering the page and return 404 if
{ notFound: true, revalidate: 5 }
is returned by getStaticProps(), no? Or am I missing something?P.S. With NEXT_PRIVATE_DEBUG_CACHE set to true I don't see any output of revalidateTag, so not sure that revalidateTag is triggered during on demand revalidation.
Beta Was this translation helpful? Give feedback.
All reactions