Reputation: 133
I have dynamic pages like: pages/posts/[slug].tsx
using incremental static generation with fallback: 'blocking', and revalidate , as the official docs are saying for this situation, " new paths not returned by getStaticPaths will wait for the HTML to be generated, identical to SSR (hence why blocking), and then be cached for future requests so it only happens once per path."
But on a new post i get 404, even after 60 seconds.
Here is the relevant code:
export async function getStaticProps({ params }) {
const postData = await fetchPostDetails(params.slug);
if (!postData) {
return {
notFound: true,
revalidate: 60,
};
}
return {
props: {
postData: postData,
},
revalidate: 60,
};
}
export async function getStaticPaths() {
const response = await fetchDynamicRoutes();
const paths = response.routes.data.postCollection.items
.map((post) => ({
params: { slug: post.slug },
}));
return {
paths,
fallback: 'blocking',
};
}
Upvotes: 0
Views: 37