update() not returning records

Not sure if I'm doing something wrong, but update() is not returning any data and the docs say by default it returns the updated record. Also, the returning property does not seem to exist as per the docs. .update({val: 123}, {returning: 'representation}) and TS complains that only count is valid. The data is actually being updated in the database. In the below code, the if (data) {} condition never fires, and the first console.log always returns undefined. If i force an error, error is working as expected.

      const { data, error } = await supabase.from('inventory').update(newRow).match({ id: newRow.id })

      console.log('data below await', data)

      if (data) {
        console.log('data from inside conditional', data)
      }

      if (error) {
        console.log('error!', error)
      }
Was this page helpful?