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
Grey
Grey2y ago
*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
ed.upton
ed.upton2y ago
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 action
Liam
LiamOP2y ago
This 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
ed.upton
ed.upton2y ago
Yeah I see what you mean Did you find a way of doing it any better?
Liam
LiamOP2y ago
Nope :/ Winded up just using client and SWR
Want results from more Discord servers?
Add your server