auto-tab-discard icon indicating copy to clipboard operation
auto-tab-discard copied to clipboard

fix(auto-discard): Exclude non-ready tabs from threshold metric

Open ditsuke opened this issue 1 year ago • 1 comments

Context

I use Sidebery, an extension much like tree-style tabs that lets me divide my trees into workspaces. Tabs in a workspace are only loaded when I switch to that workspace, which means that these tabs shouldn't be taken into account when Auto Tab Discard decides whether to auto-discard by number of active tabs.

Currently, this is not the observed behavior. Auto Tab Discard counts all tabs, ready or not ready, when deciding whether to auto-discard. This means that if I have 10 tabs in my active workspace with 45 in an inactive workspace, Auto Tab Discard will auto-discard tabs in my active workspace even when the number of active tabs is below the threshold (say 50).

Summary of changes

I've added a filter step to the auto-discard process to exclude non-ready tabs from the count of active tabs.

ditsuke avatar Jan 03 '24 22:01 ditsuke

Running a meta check simultaneously for all tabs is an expensive operation. To address the issue, use a condition within the loop instead of generating a meta for all tabs.

rNeomy avatar Jan 31 '24 12:01 rNeomy