Next.js Discord

Discord Forum

Data Fetching

Answered
Greek Harehound posted this in #help-forum
Open in Discord
Greek HarehoundOP
I'm fetching the data with fetch() function but it only fetches on build after that when I make updates it is not visible in production
Answered by Manas
export revalidate = 0
if you want to disable caching globally for the page
View full answer

16 Replies

So a fetch call returns data in a local build but not in the production build?
Greek HarehoundOP
No, it pulls the data while building and then when I update the data in the API, it is not updated on production.
Aha, I think this too is caused due to caching
Greek HarehoundOP
How can I disable caching?
export revalidate = 0
if you want to disable caching globally for the page
Answer
Else, if you just want to disable it for the fetch call then, add the argument revalidate
Greek HarehoundOP
I want to disable it for all requests
@Manas export revalidate = 0 if you want to disable caching globally for the page
Greek HarehoundOP
Where should i put this?
Below your imports
Greek HarehoundOP
IIs this working on layout?
It probably does.
Greek HarehoundOP
aight
thanks
yes it working
thank you
Oki