Reputation: 1197
I am using next.js 10 and have a [slug] page which creates dynamic pages from Contentful CMS.
I am changing the slug inside CMS and run next dev
the old slug correctly returns 404 and the new slug works.
However when I build and run next start
the old slug still returns a cached page, the new slug works properly.
I am returning revalidate 10 and have assumed the page should refresh after 10sec
export const getStaticProps: GetStaticProps<SlugRoutePageProps> = async ({
params,
}) => {
....
....
const pageData = await getPageData(params.slug)
if (pageData.total === 0) return { notFound: true }
return {
props: {
pageType: "DynamicPage",
pageProps: {
pageData,
},
revalidate: 10,
},
}
}
in getStaticPaths
I have fallback: "blocking"
, also tried fallback: true
with no difference.
Edit:
getPageData
is a basic call to the contentful api - no caching
const getPageData = async (
slug: string,
): Promise<FetchPagesResult> => {
const client = createContentfulClient()
return client.getEntries<Page>({
content_type: "page",
"fields.slug": slug,
include: 5,
order: "-sys.updatedAt",
limit: 1,
})
}
Upvotes: 3
Views: 1037