Closed papiliond closed 1 month ago
Closing as it was an issue in our custom httpClient.
const fetchHydra = async (url, options = {}) => {
try {
const result = await baseFetchHydra(url, {
...options,
headers: getHeaders
});
return result;
} catch (error) {
if (error?.response?.status === 503) {
setTimeout(() => {
window.location.reload();
}, 0);
} else {
// Here I had to rethrow the error.
throw error;
}
}
return null;
};
API Platform version(s) affected: 4.0.1 and below
Description
I am using the
<DeleteButton />
provided byreact-admin
to delete a record. This API call makes my server return a 500 response, which should trigger an error notification on the frontend. Instead, I am redirected to the list page and thera.notification.deleted
is displayed.The mutationMode is "pessimistic". I debugged the
useDeleteWithConfirmController.tsx
hook and i can confirm that theonSuccess
method is called immediately after the deletion confirmation modal is confirmed. TheonError
is not called at all. Moreover, theconvertHydraResponseToReactAdminResponse
inhydra/dataProvider.js
is called once, with anull
response.How to reproduce
Additional Context
Console log from the
convertHydraResponseToReactAdminResponse
function indataProvider.js
:'{"type":"DELETE","resource":"users","params":{"id":"/api/users/1","previousData":{"@context":"/api/contexts/User","@id":"/api/users/1","@type":"User","id":"/api/users/1","uuid":"3daa234b-e5fd-49e5-b2b3-e55f9d222b93","authenticatorId":5,"fullname":"Rita Roberts I","email":"admin@test.test","username":"admin-test-test","roles":["ROLE_ADMIN","ROLE_USER"],"password":"$2y$13$mx5JvkNodAbSrr6DYruA9eO7mQr8/Xq8jUk/N2pa1UANw7pCLz6iO","isEnabled":true,"team":["/api/teams/1"],"teamRoles":[{"team":"/api/teams/1","roleGroup":"/api/role_groups/2"}],"isDeletable":true,"createdBy":"n/a","createdAt":"2024-08-13T20:18:53+00:00","updatedAt":"2024-08-13T20:18:55+00:00","userIdentifier":"admin-test-test","originId":"1"}},"response":null}'