restClient should format http response data consistently for GET_* request types #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe there is a bug in the way convertHTTPResponseToREST is implemented as it does not attempt to format that from GET_ONE requests in the same way that data from GET_LIST requests are formatted.
To reproduce the issue, go directly to an edit page for a resource without coming from the list page (so the item wont be in the store already from the list view), which will trigger it to be loaded via GET_ONE.
h2. What convertHTTPResponseToREST does now
I believe this behavior causes a bug where data loaded by GET_ONE is a different shape in the store than data loaded by GET_LIST/GET_MANY. See screenshot below showing store data in different shapes.
I think that response.data should probably always be transformed in the same way, from a JSON-API representation that includes attributes, relationships, etc. to a plain old javascript object. This PR starts in that direction, but can you weigh in on whether my understanding here seems correct and this direction makes sense?