React-admin: CREATE type data request returns params instead of response

Created on 26 Jul 2018  路  5Comments  路  Source: marmelab/react-admin

What you were expecting:
The dataProvider CREATE type data request to return created data from the server.

What happened instead:
It returns the params you pass to it instead. If your backend adds data to the record, you are unable to access that data unless you fetch the record again.

I'm not sure if this is intended.

Related code:
https://github.com/marmelab/react-admin/blob/master/packages/ra-data-json-server/src/index.js#L123
https://github.com/marmelab/react-admin/blob/master/packages/ra-data-simple-rest/src/index.js#L127

enhancement good first issue

Most helpful comment

This is somewhat intentional - it allows to make as few assumptions as possible about the server response format.

I understand your request, but I'm afraid it would be a BC break for the simple and json-server data providers. So I'm relunctant to change their behavior - especially knowing how common and easy it is to create your own dataProvider.

Any thoughts?

All 5 comments

This is somewhat intentional - it allows to make as few assumptions as possible about the server response format.

I understand your request, but I'm afraid it would be a BC break for the simple and json-server data providers. So I'm relunctant to change their behavior - especially knowing how common and easy it is to create your own dataProvider.

Any thoughts?

In that case I would make it clear in the docs. Yesterday I had a rough day identifying where the problem was coming from. Especially considering the other data requests behave differently in that regard.

Thank you for the clarification

At least in aor-feathers-client we add this change on version 2.x (react-admin support).

https://github.com/josx/aor-feathers-client/commit/1e681448ce32eccb27ae3e219b0a57059bd49fee

Marking this as an enhancement to make on the documentation of the simple and json-server data providers

Fixed by #2262

Was this page helpful?
0 / 5 - 0 ratings

Related issues

9747749366 picture 9747749366  路  3Comments

Dragomir-Ivanov picture Dragomir-Ivanov  路  3Comments

pixelscripter picture pixelscripter  路  3Comments

ilaif picture ilaif  路  3Comments

phacks picture phacks  路  3Comments