supabase-cache-helpers icon indicating copy to clipboard operation
supabase-cache-helpers copied to clipboard

Is it possible to use the global SWR mutate with RPC?

Open pranavbadami opened this issue 3 months ago • 1 comments

Hey @psteinroe , hope you're well! Quick question, is it possible to use the global mutate() on an RPC? For example, mutate('rpc/people_list_query')? It didn't seem to work for me but I could be doing something wrong.

I also tried with:

const  { mutate } = useSWRConfig();

mutate('rpc/people_list_query')

Thanks in advance!

pranavbadami avatar Sep 12 '25 03:09 pranavbadami

Hey! This should work via custom cache updates. For your case, useRevalidateTables('rpc/my_rpc') should do what you expect.

https://supabase-cache-helpers.vercel.app/postgrest/custom-cache-updates#userevalidatetables

psteinroe avatar Sep 12 '25 05:09 psteinroe