Force refetch on navigation
Unanswered
Southeastern blueberry bee posted this in #help-forum
Southeastern blueberry beeOP
I have a route that is authenticated, i have a button that opens the login page, once the user is logged in, it is then redirected back to the page where it came from using a
The same happens whenever i update some data from the api in one route, and then navigate back to another route that has this updated data, it will show me the old one (i guess it does't refetch altogether), how could i force next to refetch the page instead of using the already fetched one?
router.push, when this happens, the page seems to not be refetched but instead shows the previously rendered one.The same happens whenever i update some data from the api in one route, and then navigate back to another route that has this updated data, it will show me the old one (i guess it does't refetch altogether), how could i force next to refetch the page instead of using the already fetched one?
4 Replies
Southeastern blueberry beeOP
I'm also using
cache: "no-cache" in every server fetch callafter the
router.push run a router.refresh (it will go the new page and use cache, but very quicly update with correct data)@riský after the `router.push` run a `router.refresh` (it will go the new page and use cache, but very quicly update with correct data)
Southeastern blueberry beeOP
I'm wondering on how to fix it even without the router push, when I click on links / browser navigation, it still keeps the old data and does not refetch it
You should use revalidate path or make the page force dynamic