We see that as soon as we call a 'delete' operation on the data provider, that react-admin pushes a CRUD_GET_ONE action onto the optimisticCalls
array in usedataProvider
.
Then after the server response on the delete operation, this is replayed and a getOne
request is issued for the meanwhile deleted record. This causes a rejected promise from the data provider (since the object is not found) which shows as an 'element not found' popup in react-admin UI.
We see this both with undoable
set to true or false, and with a redirect=list
(the pop-up shows after redirection to list page upon delete)
Why is there a CRUD_GET_ONE
action dispatched upon pressing <DeleteButton>
that gets buffered and executed after the server has deleted the object? How can we avoid the issue?
Note this comment in useDataProvider.ts
which explains why getOne
gets executed after server response, but why is the action dispatched in the first place?
// in optimistic mode, all fetch calls are stacked, to be
// executed once the dataProvider leaves optimistic mode.
// In the meantime, the admin uses data from the store.