Invalidating client side router cache after server data mutation #85399
Unanswered
mdj-uk
asked this question in
App Router
Replies: 1 comment 1 reply
-
|
Yes this is still a thing, https://nextjs.org/docs/app/api-reference/functions/revalidatePath:
AFAIK, the intention is to eventually indeed, only invalidate the relevant entries. I'll make some time to add a note to updateTag and revalidateTag, I don't remember right now, but there might have been an effort to land this in 16. Which is why it didn't end up surfaced for the tag functions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It seems that in next 16 with cache components enabled if I mutate server data in a server action and call
updateTag(cached data) orrefresh(uncached data) to immediately update the UI, the entire client side router cache is invalidated and it will perform a new prefetch for every link in the viewport (except those withprefetch={false}).So every time I mutate data I get loads of prefetching, including for pages which do not depend on the updated data, and even for static pages.
Is this correct? Is it documented anywhere? Apologies if I've missed it but I don't see anything in the docs pages for refresh or updateTag or the prefetching guide.
I seem to recall there used to be warnings in the docs that this would happen after
revalidateTagbut that it was a temporary measure and in future only the affected pages would be cleared from the router cache. (I can't find that note any more, it's possible I'm misremembering)Beta Was this translation helpful? Give feedback.
All reactions