Skip to content

fix(player): retry mounting video stats icon until DOM is ready#1212

Open
dcmclarke wants to merge 5 commits intoSevenTV:masterfrom
dcmclarke:fix/video-stats-on-load
Open

fix(player): retry mounting video stats icon until DOM is ready#1212
dcmclarke wants to merge 5 commits intoSevenTV:masterfrom
dcmclarke:fix/video-stats-on-load

Conversation

@dcmclarke
Copy link
Copy Markdown

Proposed changes

Resolves #979

When the Video Stats setting is enabled, the stats icon wouldn't show up again after a page reload until the setting was manually toggled off and on. Reported issue since December 2023.

Root cause is a timing problem, remount() was called once on mount, but at that point Twitch's DOM isn't fully ready yet and span.live-time doesn't exist. Fix replaces the single call with a retry loop (tryMount) checking for the element every 500ms, up to 10 attempts (5 seconds total). Once the element is found, remount() called successfully.

Tested: video stats icon appears automatically on page load without needing to toggle the setting.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged

@dcmclarke dcmclarke mentioned this pull request Mar 18, 2026
2 tasks
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.

[BUG] Video Stats Not Appearing

1 participant