-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Extension: inactivity timeout is only scheduled for the first pending tab #1442
Description
Summary
In the browser extension background script, TabShareExtension._onTabActivated returns immediately after scheduling a timeout for the first non-active pending tab.
When multiple tabs are in _pendingTabSelection, only one of them gets an inactivity timeout; the rest can remain pending indefinitely unless the user switches tabs again.
Where
packages/extension/src/background.ts
Current behavior
- Iterate all pending tabs
- If tab is active: clear its timer and continue
- If tab is inactive and has no timer: schedule timeout and return from the whole function
Because of the early return, remaining pending tabs are skipped.
Expected behavior
All inactive pending tabs should have timeout scheduling evaluated during the same activation event.
Why this matters
This can leave stale pending relay connections and selector tabs around longer than intended, especially if users initiate connection flows from multiple tabs/windows quickly.
Proposed fix
Remove the early return so the loop continues and all entries are processed.
I have a small patch ready and can open a PR immediately.