Skip to content

Fix popup losing track of current video after background port reconnects - #2571

Open
dieroboter wants to merge 2 commits into
ajayyy:masterfrom
dieroboter:master
Open

dieroboter wants to merge 2 commits into
ajayyy:masterfrom
dieroboter:master

Conversation

@dieroboter

@dieroboter dieroboter commented Oct 18, 2026 •

Copy link
Copy Markdown
  • I agree to license my contribution under GPL-3.0 and agree to allow distribution on app stores as outlined in LICENSE-APPSTORE

To test this pull request, follow the instructions in the wiki.


On Firefox, the segment submission popup can get stuck on the previous video after its connection to the background script drops and reconnects. Clicking "Start Segment Now" flips the button, then reverts it about 200ms later, and the segment looks unsaved until the page is reloaded.

Cause: the background keyed the popup's port by an active-tab query at connect time. If the port reconnected while a different tab was active, the port was filed under the wrong tab, later video-change updates for the real tab were posted to the dead port and swallowed, and the popup's video ID stayed frozen on the previous video. sponsorStart carries no video ID, so the segment was saved under the video actually playing while the popup checked the frozen one and found nothing.

Changes:

  • background.ts: key popupPort by port.sender.tab (cleaned up on disconnect), with the active-tab query only as a fallback; the tabs message relay also prefers sender.tab
  • PopupComponent.tsx: resync state after a port reconnect
  • SegmentSubmissionComponent.tsx: if nothing is stored under the popup's video ID, trust the sponsorStart response's creatingSegment flag instead of reverting

… reconnects

Key popupPort by port.sender.tab (with cleanup on disconnect) instead of an active-tab query at connect time, prefer sender.tab in the background tabs relay, resync popup state after a port reconnect, and trust the sponsorStart response's creatingSegment flag when nothing is stored under the popup's videoID.
Fix popup losing track of the current video after its background port reconnects

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant