Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content is not updating until re-deploy nextjs 13 and sanity

Hello i am using nextjs 13 server components using /app directory and sanity studio. my code looks like this

const Page = async () => {
  const query = groq`*[_type == "university"]`;

  const data = await sanityClient.fetch(query);
}

every time i re-deploy my site on vercel, my content loads latest updated data on the frontend. but if i change something on sanity studio and refresh my page, i only see the old changes. any help here ? thank you

like image 381
JoyShaheb Avatar asked Jan 24 '26 14:01

JoyShaheb


1 Answers

Seems like you are using Next js 13 app directory. You may try this out

const Page = async () => {
  const revalidate = 60 //Time interval
  const query = groq`*[_type == "university"]`;

  const data = await sanityClient.fetch(query, {next: {revalidate}});
}
like image 92
YES PRO MAN Gaming Avatar answered Jan 27 '26 06:01

YES PRO MAN Gaming



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!