Next.js Discord

Discord Forum

Not fetching latest data

Answered
West African Lion posted this in #help-forum
Open in Discord
Avatar
West African LionOP
Hey, I'm using mongoose and Next js. I have two pages for a character both are server components. In the first one I fetch builds (with cache : no-store) and when I click on one build I go to the second page where it fetch this particular build and I can update it. When I update one build, upon validation I redirect to the "all builds" page but datas are not updated so it shows old datas. And when I click back to particular build page it still old datas while in my mongo DB datas are updated. I have to refresh manually to have datas updated and I don't know why.
Can someone help me pls ?
Here are my fetch functions :
Image
Image

9 Replies

Avatar
West African LionOP
I explained it so bad I feel but I'll precise if u ask
Avatar
European sprat
Answer
Avatar
European sprat
you're experiencing "router cache" or "client cache", that link has a breakdown of the various scenarios and what you can do
Avatar
West African LionOP
Okay thank you I'll take a look
Avatar
West African LionOP
I looked over it but it doesn't seem to be my problem. I noticed that upon refresh, the fetch function is called right. But when I navigate out and back to the page, the fetch won't execute at all.
Avatar
European sprat
That's exactly what is discussed in that link
Avatar
West African LionOP
Okay so I struggle to understand everything
I can't figure out how to solve my issue base on this
Avatar
West African LionOP
Okay I finally understood and made it work, thank you !