Skip to content

Fix: safari bug downloadspeed#695

Merged
sigoden merged 2 commits into
sigoden:mainfrom
florinm03:fix/safari-bug-downloadspeed
Apr 26, 2026
Merged

Fix: safari bug downloadspeed#695
sigoden merged 2 commits into
sigoden:mainfrom
florinm03:fix/safari-bug-downloadspeed

Conversation

@florinm03
Copy link
Copy Markdown
Contributor

On Safari, the download speed was updating too fast. Moreover, the speed was not readable, and you could see NaN and undefined.

Some pictures before the fix
Screenshot 2026-04-26 at 12 52 23 Screenshot 2026-04-26 at 11 52 39 Screenshot 2026-04-26 at 11 48 35

Same upload on Brave:
Screenshot 2026-04-26 at 11 56 48


From what I gathered:

  • Safari fires progress events very rapidly
  • Two events fire within the same millisecond
  • Date.now() returns the same value for both, because of 1ms resolution
  • elapsed = 0 -> division by zero -> Infinity -> NaN cascade

Brave/Chrome have sub-millisecond timer resolution, so two events within the same millisecond still return different Date.now() values, and elapsed is never 0.

Here is a video of how it looked after the guard.

Screen.Recording.2026-04-26.at.12.16.51.mov

So a "throttle" was necessary, hence the elapsed < 300

Screen.Recording.2026-04-26.at.12.41.16.mov

florinm03 and others added 2 commits April 26, 2026 12:43
Co-authored-by: Copilot <copilot@github.com>
@Vlad118
Copy link
Copy Markdown

Vlad118 commented Apr 26, 2026

Looks good 😎

@sigoden sigoden merged commit 4f2dee3 into sigoden:main Apr 26, 2026
3 checks passed
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.

3 participants