Skip to content
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

Fix: Data Views: bulk deleting causes a countdown experience in modal #64407

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Rishit30G
Copy link
Contributor

@Rishit30G Rishit30G commented Aug 9, 2024

What?

This PR is intended to fix: #64405

Why?

When bulk deleting items, the loading state numbers should not be changed in the modal

How?

initialItemCount is a ref that holds the initial number of items. The value of a ref persists across re-renders, so even if items.length changes, initialItemCount.current will still hold the original number of items.

Testing Instructions

Test on a site with at least 100+ pages. Here's a playground link that will spin up a version.
Open the Site Editor > Pages.
Switch to Grid layout.
Bulk edit and select all.
Move the items to trash.
Notice the modal counts down from 20.

Screenshots or screencast

Screen.Recording.2024-08-09.at.3.49.48.PM.mov

Copy link

github-actions bot commented Aug 9, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Rishit30G <rishit30g@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: annezazu <annezazu@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@akasunil akasunil added [Type] Bug An existing feature does not function as intended [Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond labels Aug 10, 2024
@Rishit30G
Copy link
Contributor Author

Hey @t-hamano!
Would appreciate if you could please review this PR 🙇
For some reason, reviewer was not assigned to this PR

@t-hamano t-hamano self-requested a review August 13, 2024 13:54
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the ping!

This approach seems reasonable to me, but I'm not familiar with bulk actions, so I'd like to add some reviewers who are familiar with this feature.

My other concern is that this issue will not only occur when deleting pages, but also when deleting patterns, templates, and template parts, i.e. here:

'Delete %d item?',
'Delete %d items?',

@Rishit30G
Copy link
Contributor Author

No problem, thanks for assigning it to other reviewers! 🙇
Sure, if the other reviewers also agree upon this approach, I'll update the other pages as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data Views: bulk deleting causes a countdown experience in modal
3 participants