Page data is not refetched when navigating
Answered
Southeastern blueberry bee posted this in #help-forum
Southeastern blueberry beeOP
I have the main page that has all the info of the different lectures, then another edit page that is used to update the data of one lecture. When i go from the main page to the edit lecture page, update the info, then come back, the data in the main page is not updated.
Looking at the dev tools it seems like there is no further requests when navigating to already visited pages, but i'd like to have it refetch it every time, how can i change this behaviour?
I think this might be a issue with client side navigation but, the whole app uses SSR with the app router (all this data is loaded by the server)
Looking at the dev tools it seems like there is no further requests when navigating to already visited pages, but i'd like to have it refetch it every time, how can i change this behaviour?
I think this might be a issue with client side navigation but, the whole app uses SSR with the app router (all this data is loaded by the server)
Answered by fuma
It is due to [Router Cache](https://nextjs.org/docs/app/building-your-application/caching#router-cache) (aka client-side cache)
Next.js caches your page at the client-side to ensure better performance, you can't opt out of router cache for now.
You may invalidate the cache by calling
Next.js caches your page at the client-side to ensure better performance, you can't opt out of router cache for now.
You may invalidate the cache by calling
router.refresh, or using Server Actions Mutations5 Replies
Southeastern blueberry beeOP
I see that it makes a call to some sort of id that resolves to 0 bytes, what is that for? Is it perhaps to check if the page needs to revalidate? I was thinking maybe I need to use something like revalidatePath or revalidateTag
If there is a setting I can enable to completely disable this behaviour for now it would be fine, as I can work on making it work properly in the future
It is due to [Router Cache](https://nextjs.org/docs/app/building-your-application/caching#router-cache) (aka client-side cache)
Next.js caches your page at the client-side to ensure better performance, you can't opt out of router cache for now.
You may invalidate the cache by calling
Next.js caches your page at the client-side to ensure better performance, you can't opt out of router cache for now.
You may invalidate the cache by calling
router.refresh, or using Server Actions MutationsAnswer
@fuma It is due to [Router Cache](https://nextjs.org/docs/app/building-your-application/caching#router-cache) (aka client-side cache)
Next.js caches your page at the client-side to ensure better performance, you can't opt out of router cache for now.
You may invalidate the cache by calling `router.refresh`, or using Server Actions Mutations
Southeastern blueberry beeOP
Ok thank you, I guess for now I'll use router.refresh, is there a way to revalidate only a certain path in the client? (Like revalidatePath does)
Unfortunately, no