Closed zoundfreak closed 3 years ago
Could the following promise in the hydra data provider cause this issue? The data content id is set to null.
React Admin documentation states:
Data Providers methods must return a Promise for an object with a data property.
delete => { data: {Record} } The record that has been deleted
A {Record} is an object literal with at least an id property, e.g. { id: 123, title: "hello, world" }.
The documentation can be found here:
https://marmelab.com/react-admin/doc/3.6/DataProviders.html#response-format
Hello. That was not the right fix, but it's a good thing anyway, so I've done it in this PR: https://github.com/api-platform/admin/pull/365. For your issue, it will be fixed in the next release.
Nice! Good to know!
API Platform version(s) affected 2.6.1 (standard distribution) with 2.5.8 admin
Description
When I delete any item from the edit view by clicking the delete button, the following happens:
For example deleting a book (following the APIP setup guide examples) with id 6, a DELETE request is sent to https://localhost/books/6. That request gets 204 as a response code with empty response body.
Right after the previous request a new GET request is now sent to https://localhost/books/6. Now the book with id 6 doesn't exist anymore and the request gets a 404 response, which in turn is shown in the UI.
NOTE: This only happens when deleting items by clicking the delete button. Deleting directly from the listing works fine.
I tried this with both a fresh install of the latest standard distribution and custom built apps with the same versions. I've tried setting undoable to both true and false.
This causes two kinds of problems for me:
I need to release my application in the coming days and this is a huge show stopper. I cannot figure out a way to fix this myself.
How to reproduce
Possible Solution
To my understanding, React Admin expects DELETE to return the deleted instance back. Currently nothing is returned. Could this be the reason for the extra request?