-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update fails when nothing is changed #141
Comments
Thank you for reporting the issue. Do you have any minimal example somewhere? |
I've created a small example project: https://github.com/copierrj/react-admin-test A docker-compose for the backend (PostgreSQL + PostgREST) used by this project can be found here: https://github.com/copierrj/pagila/tree/postgrest The problem is demonstrated in this form: https://github.com/copierrj/react-admin-test/blob/4161ffeb0c76dff5048156e5ae3f8dcf5b7175d6/src/CustomerEdit.tsx#L23-L37 Editing address details (stored in resource |
I have a few places I've run into this, one recently is many to many inputs trigger an empty patch on the edited resource |
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:The text was updated successfully, but these errors were encountered: