Next.js Discord

Discord Forum

Next.js revalidateTag causing full route refresh

Unanswered
Beagle posted this in #help-forum
Open in Discord
BeagleOP
Hey! I’m seeing that calling revalidateTag() in a server component causes the entire page/route to rerender instead of updating only the tagged data. I found a few GitHub issues but nothing confirming if this is expected behavior or if finer-grained updates are planned.
Is this a known limitation right now, or something the team is working to improve?

9 Replies

African Slender-snouted Crocodile
Also seeing this for updateTag.
Next.js needed a way to re-render the whole page once a form is submitted. They hope that developers cache components and functions properly so that only the tagged data is updated.
Currently there is no native way to only PURELY update the component that is affected unless you are using client components to handle the response.
If you only want the classical behavior of revalidateTag you might want to resort to calling in API handler and not in server actions.
African Slender-snouted Crocodile
Well, it's less about "purely update that component", but more like - I have use cache: private on all of my other components. I am not updating their tags. So when the page refreshes, those should remain cached, right? I understand the whole page will reload but the other caches shouldn't be invalidated in this case?
yep
but i havent tested what and how use cache: private works yet but im sure thats usually the case with normal 'use cache'
if you have different problem than OP please create a new thread