Skip to content

Improve Recycle Bin item existence check performance#18424

Open
muko wants to merge 1 commit intofiles-community:mainfrom
muko:fix/improve-recycle-bin-item-existence-check-performance
Open

Improve Recycle Bin item existence check performance#18424
muko wants to merge 1 commit intofiles-community:mainfrom
muko:fix/improve-recycle-bin-item-existence-check-performance

Conversation

@muko
Copy link
Copy Markdown
Contributor

@muko muko commented Apr 25, 2026

Resolved / Related Issues

Bug: Slow file selection when Recycle Bin has many files #18420

Steps used to test these changes

  • When a file is selected, the state updates in under 1 second.
  • StorageTrashBinService.HasItems() returns true when the Recycle Bin contains items, and false when it is empty.

/// <inheritdoc/>
public bool HasItems()
{
return QueryRecycleBin().NumItems > 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The QueryRecycleBin method is used in other places as well. IF there is an alternative, we should update the method directly so these improvements apply across the board.

Copy link
Copy Markdown
Contributor Author

@muko muko Apr 27, 2026

Choose a reason for hiding this comment

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

QueryRecycleBin() returns whether the Recycle Bin exists, along with the total item count and total size.
Since HasItems() only needs to check whether any items exist, calling QueryRecycleBin() is unnecessary here.

@yair100 yair100 added the ready for review Pull requests that are ready for review label Apr 27, 2026
@yair100 yair100 requested review from 0x5bfa and hishitetsu April 28, 2026 02:11
Copy link
Copy Markdown
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

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

I'm very against using the C# APIs over the Shell APIs but if this does improve the performance, lgtm.

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

Labels

ready for review Pull requests that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants