ra-data-postgrest
ra-data-postgrest copied to clipboard
Update fails when nothing is changed
When manipulating multiple related resources in a single form (using ReferenceManyInput, ReferenceOneInput, etc.) the update function of the data provider gets called for every resource. When no fields of a particular resource are changed update gets called with the same value for 'data' and 'previousData'.
Because ra-data-postgrest only updates changed fields, a PATCH request with an empty object ({}
) is send to PostgREST resulting in an error:
{
"code":"PGRST116",
"details":"The result contains 0 rows",
"hint":null,
"message":"JSON object requested, multiple (or no) rows returned"
}