-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
useCreateResult data contains the update parameters and not the response data #7912
Comments
We fixed a similar bug in v4 in #7783 |
I don't understand how that is possible looking at the react-admin code: The create success action uses the response payload (the data returned by the API), and that's what is used in the data reducer. The problem may lie in your dataProvider. Can you build a reproduction case based on the simple example codesandbox? https://codesandbox.io/s/github/marmelab/react-admin/tree/3.x/examples/simple |
The problem is actually in ra-data-simple-rest. Compare these two section for
|
You're right, the problem comes from ra-data-simplerest. Would you mind opening a PR to fix it? Note: the problem occurs both in v3 and v4. |
Done! |
What you were expecting:
useCreateResult.data will contain all fields returned from the API, just like useUpdateResult.data does.
What happened instead:
useCreateResult.data contains the data sent to the API instead of the data returned from it.
Steps to reproduce:
Any API that returns a calculated value in one of the fields (i.o.w. the field is not part of the data sent to the API, but rather generated by the API for consumption by the RA app) and a custom data provider method in RA that consumes the value, similar to the logo upload example. I ran into this when doing logo uploads using S3 signed URL.
Related code:
Other information:
N/A
Environment
The text was updated successfully, but these errors were encountered: