Refresh server-component data on client-side mutation
Unanswered
Harlequin posted this in #help-forum
HarlequinOP
If I have an item page that is a server page, but I have a button on that page that archives the item and triggers a client-side mutation (supabase) to update the record in the DB.
Is the best way to have the page-level data update for the user to trigger a server-action after the successful mutation to revalidate the current path?
It feels like the right approach, but also feels overly complex given you can't call revalidatePath directly on the client. Exposing an action that only does that feels a bit hacky like an anti-pattern.
Any advice would be great here! Thank you!
(Also, if this is the right approach, is it worth having client-side mutations or should those be shifted into server actions instead?)
Is the best way to have the page-level data update for the user to trigger a server-action after the successful mutation to revalidate the current path?
It feels like the right approach, but also feels overly complex given you can't call revalidatePath directly on the client. Exposing an action that only does that feels a bit hacky like an anti-pattern.
Any advice would be great here! Thank you!
(Also, if this is the right approach, is it worth having client-side mutations or should those be shifted into server actions instead?)