Skip to content

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Sep 8, 2025

Problem

Just like the <DeleteButton> we want a controller hook that ease the implementation of <BulkDeleteButton> in custom UIs.

Solution

Introduce useBulkDeleteController

How To Test

The <BulkDeleteWithConfirmButton> and <BulkDeleteWithUndoButton> should work as before.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
    - [ ] The PR includes unit tests (if not possible, describe why) we decided to not invest more in tests as we already have some for the existing buttons.
    - [ ] The PR includes one or several stories (if not possible, describe why) Same
    - [ ] The documentation is up to date Same

Also, please make sure to read the contributing guidelines.

@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Sep 8, 2025
@slax57 slax57 self-requested a review September 11, 2025 09:48
Comment on lines 59 to 61
const handleConfirm = e => {
setOpen(false);
handleDelete();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not equivalent to the behavior we had before: now you will close the Dialog immediately, even if an error occurred

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I missed that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking about this again, this is still not equivalent. In pessimistic mode, the dialog would be closed after the end of the mutation, whereas now it is closed immediately. This means the user would be redirected to the list too soon, as the refresh will only happen later, when the mutation succeeds.
So we definitely need an onSettled here I believe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slax57 slax57 merged commit 9a5757c into next Sep 15, 2025
15 checks passed
@slax57 slax57 deleted the use-bulk-delete-controller branch September 15, 2025 14:08
@slax57 slax57 added this to the 5.12.0 milestone Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Development

Successfully merging this pull request may close these issues.

2 participants