Next.js Discord

Discord Forum

how to revalidate page?

Unanswered
Southern Martin posted this in #help-forum
Open in Discord
Southern MartinOP
I'm using strapi for blog post and my blog listing page is server component where i'm calling api & showing list but issue is i am not able to see new blog one it in production. can anyone help how can i revalidate it?

12 Replies

Basenji
I believe you need to trigger a rebuild. I’m not familiar with strapi, but I have a blog that uses sanity. When a publish a new post, it fires a rebook to trigger a rebuild. https://vercel.com/docs/deployments/deploy-hooks#triggering-a-deploy-hook
Not sure what strapi does but you would still be using some fetch library. Not sure about axios but you can revalidate on fetch()
Southern MartinOP
I tried few things: 1)unstable_noStore() 2) export const revalidate = 10 3) revalidatePath("/blogs") inside blog listing component.
can anyone pls explain more?
@Southern Martin you need to make an api route, insdie it do the revalidatePath("/blogs");
Call that from strapi
Southern MartinOP
@Arinji can't do this because I am just fetching data from strapi api which returns few blogs which i am showing to UI.
Southern MartinOP
I wrapped that function with React.cache is it not okay..?
@Southern Martin I wrapped that function with React.cache is it not okay..?
react cache is for deduplication, not caching