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

Mutation Support for RPC Queries

Open rgathmann opened this issue 7 months ago • 3 comments

Is your feature request related to a problem? Please describe. I seem to be unable to perform a complex insert or update mutation using a Supabase DB Function and rpc call and have other queries invalidated. There may be a way to do this day, but I just can't seem to figure it out from the docs.

Describe the solution you'd like I would like to be able to trigger and rpc mutation then invalidate existing queries.

Describe alternatives you've considered None, I am stuck here.

Additional context An example might look something like this:

  const { mutateAsync: insertAsync } = useInsertMutation(
    createClient().rpc('create_journey', { name: 'some_name_here'}),
    // createClient().from('journeys'),
    ['id'],
    'id',
    {
      revalidateTables: [{ schema: 'public', table: 'member_journeys' }],
      onSuccess: () => console.log('Insert success!'),
      onError: (err) => console.log(err),
    }
  );

rgathmann avatar Aug 02 '24 18:08 rgathmann