Extension can only delete one page of emails at a time #81

Open
opened 2025-11-12 15:45:24 -05:00 by MCDELTAT · 9 comments
MCDELTAT commented 2025-11-12 15:45:24 -05:00 (Migrated from github.com)

First off, thanks for the extension and open sourcing things. I saw you're video and it looks nice. I've basically abandoned an email because I get too many messages there.

Specs:

OS: Linux Mint 22.2
Browser: Chromium 141.0.7390.107
Extension Version: 2.1.0

What's Happening

  • I scanned the first half of my inbox to get top senders (it was ~2,400 pages).
  • I then click unsubscribe for a single sender with the "Delete ## email(s) from selected senders".
  • It deletes a single page and then freezes.
  • If I can cancel by clicking out, I can hit delete, it will delete a single page of 50, then produce the UI error "There was an error deleting the selected senders."

If I repeat this process many times manually, the extension will stop working altogether. I have to close my Gmail tab and bring it back.

I'm not sure what logs you'd want to debug but obviously willing to send anything over for triage.

First off, thanks for the extension and open sourcing things. I saw you're video and it looks nice. I've basically abandoned an email because I get too many messages there. ## Specs: OS: Linux Mint 22.2 Browser: Chromium 141.0.7390.107 Extension Version: 2.1.0 ## What's Happening * I scanned the first half of my inbox to get top senders (it was ~2,400 pages). * I then click unsubscribe for a single sender with the "Delete ## email(s) from selected senders". * It deletes a single page and then freezes. * If I can cancel by clicking out, I can hit delete, it will delete a single page of 50, then produce the UI error "There was an error deleting the selected senders." If I repeat this process many times manually, the extension will stop working altogether. I have to close my Gmail tab and bring it back. I'm not sure what logs you'd want to debug but obviously willing to send anything over for triage.
aioue commented 2025-11-12 16:00:33 -05:00 (Migrated from github.com)

Same:
Image

Same: <img width="478" height="161" alt="Image" src="https://github.com/user-attachments/assets/f96b819f-817c-4a40-a80a-316c538fbff9" />
Oskimark commented 2025-11-13 10:23:31 -05:00 (Migrated from github.com)

same. just 75 emails from 10 senders, click delete and get that error. first time user.

same. just 75 emails from 10 senders, click delete and get that error. first time user.
pkali commented 2025-11-14 08:36:37 -05:00 (Migrated from github.com)

same, chromium ubuntu. works when <100 emails from a sender

same, chromium ubuntu. works when <100 emails from a sender
jereditt commented 2025-11-14 10:50:57 -05:00 (Migrated from github.com)

A quick work around until a fix is found, is to use the delete button in the extension once. If it fails, then use the search query that it created to select and delete emails for each page. It is still time consuming, but the extension makes the query creation way easier.

A quick work around until a fix is found, is to use the delete button in the extension once. If it fails, then use the search query that it created to select and delete emails for each page. It is still time consuming, but the extension makes the query creation way easier.
MCDELTAT commented 2025-11-14 12:21:37 -05:00 (Migrated from github.com)

Yeah @jereditt I noticed that when you do that, if you go too fast, before gmail loads the next 50, it will error out. I wonder if that's what's happening on this issue as well. The extension may be trying to delete the next page or select a piece of the DOM before it is marked as ready. Might be good to add in some async callbacks to ensure the DOM is ready for the next delete operation.

Yeah @jereditt I noticed that when you do that, if you go too fast, before gmail loads the next 50, it will error out. I wonder if that's what's happening on this issue as well. The extension may be trying to delete the next page or select a piece of the DOM before it is marked as ready. Might be good to add in some async callbacks to ensure the DOM is ready for the next delete operation.
ZingBing commented 2025-11-20 14:41:22 -05:00 (Migrated from github.com)

I have also been running into the deletion failures mentioned above (definitely seems like it could be a timing/race condition when paging through the email chunks). I wanted to propose an alternative deletion flow that might avoid the issue, if it hasn't been tried already.

Idea: Why not use Gmail's built in "Select all conversations that match this search" banner and perform a single delete action? From what I can tell, the delete button's intention is to delete all conversations matching the query anyway. Using the banner would mean the extension doesn’t need to step through each page of 50 emails and wait for the DOM to update, which should avoid most of the async timing problems.

We could load the search URL that the extension already creates, select the checkbox, and wait for the yellow banner that deletes all and click its link.

I definitely think this should include an extra confirmation of some sort since it can delete thousands of emails at once, but that may help in terms of reliability for the heavier cleanup tasks.

If this seems useful I'd be happy to help work on it, I do really like the extension and think it's nice to get a clear view on what is really cluttering my inbox after a number of years of ignorance!

I have also been running into the deletion failures mentioned above (definitely seems like it could be a timing/race condition when paging through the email chunks). I wanted to propose an alternative deletion flow that might avoid the issue, if it hasn't been tried already. Idea: Why not use Gmail's built in "Select all conversations that match this search" banner and perform a single delete action? From what I can tell, the delete button's intention is to delete all conversations matching the query anyway. Using the banner would mean the extension doesn’t need to step through each page of 50 emails and wait for the DOM to update, which should avoid most of the async timing problems. We could load the search URL that the extension already creates, select the checkbox, and wait for the yellow banner that deletes all and click its link. I definitely think this should include an extra confirmation of some sort since it can delete thousands of emails at once, but that may help in terms of reliability for the heavier cleanup tasks. If this seems useful I'd be happy to help work on it, I do really like the extension and think it's nice to get a clear view on what is really cluttering my inbox after a number of years of ignorance!
anna-st-40 commented 2025-11-20 17:21:34 -05:00 (Migrated from github.com)

@ZingBing This sounds like a solid solution if the "Select all conversations that match this search" is something that always shows up. From my preliminary testing in my own Gmail inbox, it only appears when selecting all without a search.

So, for example, without anything in the search bar it appears:

Image

But as soon as I put something in the search bar and carry out the same steps, it no longer appears:

Image

Am I missing something, or is this one of those Gmail UI things that somehow varies between accounts?

@ZingBing This sounds like a solid solution if the "Select all conversations that match this search" is something that always shows up. From my preliminary testing in my own Gmail inbox, it only appears when selecting all _without_ a search. So, for example, without anything in the search bar it appears: <img width="2388" height="512" alt="Image" src="https://github.com/user-attachments/assets/a5e030fb-dae8-47d4-8345-8dd5bbb9e013" /><br><br> But as soon as I put something in the search bar and carry out the same steps, it no longer appears: <img width="1194" height="202" alt="Image" src="https://github.com/user-attachments/assets/667d6117-27e4-45f8-9757-6cf80ce389ab" /><br><br> Am I missing something, or is this one of those Gmail UI things that somehow varies between accounts?
ZingBing commented 2025-11-20 20:24:16 -05:00 (Migrated from github.com)

@anna-st-40 It took me a while to realize, but I believe it will consistently show up as long as the sorting selector on the side to the right is set to Most recent as opposed to Most relevant. I actually found this out when I tried using the extension originally and the delete feature wasn't working, and thought there should be some easy builtin way to delete all conversations. However, the option wasn't showing up for me either... only after some digging did I discover that this was the reason.

Most recent selected
Image

Most relevant selected
Image

As you can see, with Most recent selected I have the option to select all conversations, even though there is a filter on the search.
So I guess my idea would also include ensuring that Most recent is selected when doing a mass delete.

@anna-st-40 It took me a while to realize, but I believe it will consistently show up as long as the sorting selector on the side to the right is set to `Most recent` as opposed to `Most relevant`. I actually found this out when I tried using the extension originally and the delete feature wasn't working, and thought there should be some easy builtin way to delete all conversations. However, the option wasn't showing up for me either... only after some digging did I discover that this was the reason. **Most recent** selected <img width="1355" height="244" alt="Image" src="https://github.com/user-attachments/assets/70f1d3bc-6f05-4aa3-a7c1-01dc7809860e" /> **Most relevant** selected <img width="1391" height="209" alt="Image" src="https://github.com/user-attachments/assets/55650a3f-344d-4c78-8569-6cb8f8c32cc6" /> As you can see, with `Most recent` selected I have the option to select all conversations, even though there is a filter on the search. So I guess my idea would also include ensuring that `Most recent` is selected when doing a mass delete.
anna-st-40 commented 2025-11-21 00:15:23 -05:00 (Migrated from github.com)

@ZingBing Got it, that makes sense. If you’re up for it, go ahead and try implementing it. I’d be happy to review and test.

@ZingBing Got it, that makes sense. If you’re up for it, go ahead and try implementing it. I’d be happy to review and test.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
InboxWhiz/gmail-declutter-extension#81
No description provided.