Updated data not being fetched in production.
Hey guys so i just made a web app which uses prisma / planetscale and tanstack query.
I have been trying to fetch data from the code below
It works perfectly fine in the local enviroment but the deployed version of the app doesn't fetch the updated data from database at all what might be the problem here ?
6 Replies
this one is route
https://nextjs.org/docs/app/building-your-application/routing/router-handlers#behavior
Try with NextResponse, your route is probably being statically evaluated.
thank you , but i got it it was happening because of caching
how did you fix it?
i just needed to revalidate the data fetching apparently it was calling the api for 1 time and then using that throughout so i added export const revalidate = 0; at top my route
Yeah, it was statically evaluated, you just forced to it to be dynamic. Usually, you wouldn't need to do that since using the Request object should automatically make the route dynamic by default.