Refresh a RSC
Hello,
Is there a way to have a server component refresh itself programmatically? Essentially I have a server action that runs and then I want to have a specific server component rerender.
Thanks!
5 Replies
*Advise from someone who has only read docs on rsc/server-actions
Basically to my current knowledge, you create an isolated client component, and on some event you call router.refresh() to refresh the component to reflect the update programmatically
I have found that using
revalidatePath("<the_path_of_your_page");
has been working pretty well. It doesn't refresh the page, but more re-runs the server parts whilst maintaining the state
You can put this towards the end of your server actionThis seems to just wipe the cached data for the page though, not do a reload w/o reloading the whole page.
If I understand correctly
Yeah I see what you mean
Did you find a way of doing it any better?
Nope :/
Winded up just using client and SWR