How to refresh a Server Component?
Answered
Black-headed Grosbeak posted this in #help-forum
Black-headed GrosbeakOP
Hi, I am new to Next.js and I am using Server components and Server actions. I have a server components which I want to refresh after a Server Action of another client component has finished. Is there a way to only refresh a single server component instead of the whole route?
Answered by Clown
Ahh i get what you mean now, but i cant remember if there is any way to do that without revalidating the whole route.
4 Replies
Black-headed GrosbeakOP
I did but as far as I unterstood It only works when I use the
fetch function, which I don't because I directly query my database from the server componentAhh i get what you mean now, but i cant remember if there is any way to do that without revalidating the whole route.
Answer
Black-headed GrosbeakOP
I think so too sadly..
It currently is like that:
Server Component selects a sql table.
Client Component inserts another record to the table
=> Server Component has to reload
But you are right revalidating the whole route works although I do not really like the solution
It currently is like that:
Server Component selects a sql table.
Client Component inserts another record to the table
=> Server Component has to reload
But you are right revalidating the whole route works although I do not really like the solution