Next.js Discord

Discord Forum

Revalidate Tag

Answered
Korat posted this in #help-forum
Open in Discord
KoratOP
If I am using revalidate tag in one of my server actions, even though the fetching of 'let's say users' doesnt have a tag appended, it still requests the RSC which revalidates those data.

Does revalidate tag revalidates the whole cache if the tag isn't found or what because I am a bit confused.
Answered by Arinji
Awesome, mark this as a solution. Btw issues take a whole to be seen by the nextjs team so no need to keep opening the issue.
View full answer

30 Replies

So you're saying that your call to revalidateTag() is revalidating other, non-related, non-tagged cache?
KoratOP
This is confusing me as well, like:

I have a table of users and a button in the last cell to delete that user, when I delete, i call revalidateTag("whatever") and its recalling the rsc which is returning the fresh data 👀
KoratOP
I just wanna know how it works under the hood, if the tag doesnt exist, does it revalidate the whole cache or?

Because as mentioned Im not adding a tag when calling the fetch
KoratOP
Okay, but I cant explain why calling revalidateTag with a dummy string inside is revalidating the list of users
which is nice
but I dont know how
thats not meant to happen
can you show me your data fetching code
KoratOP
This is the most basic example
blocking a user shows the isBlocked boolean in the table when invalidateTag is called
is it maybe the case that revalidating that tag, is causing something in the stack to re-render?
if you make an example/testing page, and then make a fetch call, tag it, and then revalidate it, you can confirm functionality.
KoratOP
But this tag doesn't exist ?
@Tyler is it maybe the case that revalidating that tag, is causing something in the stack to re-render?
KoratOP
Yeah, that's what I'm thinking but initially I thought even the tag doesn't exists it revalidates everything
@Korat Yeah, that's what I'm thinking but initially I thought even the tag doesn't exists it revalidates everything
if you get rid of the revalidate tag call, does it "revalidate everything" still?
may need to see more code to 100% know whats going on.
KoratOP
In that case no, I need to hard reload to get the new info
also yea we need code lol
make a minimal reproduction
KoratOP
I am on development, Ill try in prod too

The project is big, in that case Ill try a basic repo just to test it out
KoratOP
@Arinji I was able to reproduce this in a NextJS 15 fresh app though,

Only these 3 files are needed
Or you still need a codesandbox link ?
Make a GitHub issue then since it's clearly a bug
KoratOP
@Korat <@890486507872342027> https://github.com/vercel/next.js/issues/71612 done
Awesome, mark this as a solution. Btw issues take a whole to be seen by the nextjs team so no need to keep opening the issue.
Answer