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
Grey13mo 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.upton13mo 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
Liam13mo 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.upton13mo ago
Yeah I see what you mean Did you find a way of doing it any better?
Liam
Liam13mo ago
Nope :/ Winded up just using client and SWR
Want results from more Discord servers?
Add your server
More Posts