Next.js Discord

Discord Forum

To invalidate a RSC page to re-render is revalidatePath the right approach?

Answered
British Shorthair posted this in #help-forum
Open in Discord
British ShorthairOP
I fetch some queries in a page that's rendered on the server, but when i invalidate those queries nothing happens on the page. Granted, I can solve this via the client, but i was wondering how to make it refetch those server queries? My assumption is that the page is cached, so i need to revalidate the page itself, which would be through revalidatePath?
Answered by ᴉuɐpɹɐɐ
I fetch some queries in a page that's rendered on the server, but when i invalidate those queries nothing happens on the page.
If you are invalidating it via route handler youd need to refresh the page manually.

If you want your page to be automactically refreshed use server action and call revalidatePath there
View full answer

18 Replies

I fetch some queries in a page that's rendered on the server, but when i invalidate those queries nothing happens on the page.
If you are invalidating it via route handler youd need to refresh the page manually.

If you want your page to be automactically refreshed use server action and call revalidatePath there
Answer
British ShorthairOP
Gotcha, ty!
i have 2 functions that are exactly the same
I call them both from the same 'use client' component
the upload fn revalidate the path correctly
but the delete function does not revalidate the path at all. UNTIL I hard refresh the browser
@Vespid wasp Click to see attachment
thats strage, my revalidatePath always retrigger server render. Can you open up a new thread and provide more information?
@ᴉuɐpɹɐɐ thats strage, my revalidatePath always retrigger server render. Can you open up a new thread and provide more information?
Vespid wasp
8h of debugging, still can't figure out if it's me or next.js bug I tried everything.

the only thing i understand which is even weirder to me is : when i hit the "deleteByFileId" server function twice, it will revalidate the previous one 😂
it goes on like that everytime -1 render
Wait i'll record a little Loom video it's so weird
Arghhh this time it's even weirder than ever at the end wtf
Vespid wasp
@ᴉuɐpɹɐɐ Do you have any idea what can cause this? Sorry for tag, i'm so desperate 😕
@ᴉuɐpɹɐɐ https://discord.com/channels/752553802359505017/1240833949622603786/1248089338886094891
Vespid wasp
I saw that, but i don't know what information i can provide to help, I provided the things i though were necessary.

I can open a new thread tho