After hook for bulkDelete action does not fire after the deletion if deletion fails
Describe the bug
When using after hooks with the bulkDelete action, the hook runs after the GET request that populates the confirmation modal/drawer is made, but not after the POST request that actually does the delete.
Installed libraries and their versions
To Reproduce Steps to reproduce the behavior:
- Add an
afterhook on a resource's bulk delete action that simply console.log()s when it runs - Bulk delete some records for that resource that cannot be deleted due to a foreign key constraint
- The
afterhook will run when the list of records is returned to the frontend and the confirmation drawer is displayed - The
afterhook does not run when the records are actually attempted to be deleted
Expected behavior
The after hook runs after the delete takes place
Can you show your after hook?
The minimum I need to see the issue is just a console.warn:
const afterHook = (originalResponse, _request, _context) => {
console.warn('in bulkDelete After Hook');
return originalResponse
};
Before running bulk delete (console output is on the left):

After the GET request fires to list the to-be-deleted records, the hook is run:

The hook does not run again after the POST, at least if the delete is not successful in the database:

My goal is to be able to catch that error, and do something more useful with it.
Trying it now with records that can be deleted, the hook does run if the delete is successful. This is different than the non-bulk delete action, which runs the after hook even if the deletion fails.