Skip to content
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

CREATE type data request returns params instead of response #2087

Closed
FacundoMainere opened this issue Jul 26, 2018 · 5 comments
Closed

CREATE type data request returns params instead of response #2087

FacundoMainere opened this issue Jul 26, 2018 · 5 comments

Comments

@FacundoMainere
Copy link

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

@fzaninotto
Copy link
Member

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?

@FacundoMainere
Copy link
Author

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

@josx
Copy link
Contributor

josx commented Jul 27, 2018

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

josx/aor-feathers-client@1e68144

@djhi
Copy link
Contributor

djhi commented Aug 30, 2018

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

@fzaninotto
Copy link
Member

Fixed by #2262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants