Skip to content

fix(ui): toggle list selections off on successful bulk action #12861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

akhrarovsaid
Copy link
Contributor

What?

This PR threads an onSuccess callback to bulk actions which get called after a successful action. In this case, the callback toggles the list selections off after a successful edit many, publish many, or unpublish many.

Why?

To ensure list selections are toggled off after a successful action.

How?

By threading a new onSuccess callback through the actions' props.

Fixes #12855

Before

CleanShot.2025-06-18.at.11.24.39.mp4

After

Draft-Posts---Payload.webm

Notes:

  • I wanted to add/extend some e2e tests for this behavior inside of test/bulk-edit. However, the way the checkbox input seems to work is via defaultChecked and onInput instead of checked and onChange, which seems to make the checkboxes checked dom property lag a render behind (meaning expect().toBeChecked() can be misleading or return the wrong value). Open to suggestions here.
  • Not all actions necessarily need to clear the selection, I'm open to suggestions here as well.

Copy link
Member

@jacobsfletch jacobsfletch left a comment

Choose a reason for hiding this comment

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

This is looking good but yes we will need to add a test. I can help with this if you're still having troubles. Also if you merge main into this branch, the CI failures should now resolve.

@akhrarovsaid
Copy link
Contributor Author

Hey @jacobsfletch

Thanks for your patience here. I've added 3 tests to the existing bulk-edit suite - one for each of edit, publish, and unpublish. Let me know if they're up to standards or if you'd like further changes. Thanks again for your time!

@jacobsfletch jacobsfletch merged commit 9f17db8 into payloadcms:main Jun 25, 2025
77 checks passed
@akhrarovsaid akhrarovsaid deleted the fix/list-bulk-action-toggle-selection branch June 25, 2025 21:07
JarrodMFlesch added a commit that referenced this pull request Jun 27, 2025
#12861 introduced some flaky
test selectors. Specifically bulk editing values and then looking for
the previous values in the table rows.

This PR fixes the flakes and fixes eslint errors in `findTableRow` and
`findTableCell` helper funcitons.
Copy link
Contributor

🚀 This is included in version v3.44.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bulk edit checkboxes not cleared on success
2 participants