GenerateStaticParams with revalidation
Unanswered
Forest bachac posted this in #help-forum
Forest bachacOP
In App Dir, is it possible to generate static params at build, but also update these incrementally?
For example in the docs, it shows this:
If I did this, but added the next: revalidate: stuff would it work? Or is there another way to do this without going full SSR?
For example in the docs, it shows this:
export async function generateStaticParams() {
const posts = await fetch('https://.../posts').then((res) => res.json())
return posts.map((post) => ({
slug: post.slug,
}))
}If I did this, but added the next: revalidate: stuff would it work? Or is there another way to do this without going full SSR?
9 Replies
European sprat
generateStaticParams only runs at build time so you'll need to add a fetch in the component tooForest bachacOP
so basically i can't use generateStaticParams right?
@European sprat `generateStaticParams` only runs at build time so you'll need to add a fetch in the component too
Forest bachacOP
if you use generatestaticparams can you remove/add new params later?
@Forest bachac if you use generatestaticparams can you remove/add new params later?
if you access params thats not included in the generateStaticParams, they will be build once at request time, cached to the build cache
Its called ISR
Japanese Bobtail
That makes sense on how it would add params later, is there a way to remove them if they no longer exist?
you can set a invalidation timer on your articles
so that it needs to be checked if it still exists after a certain period of time