Skip to content

Show upload progress in stages: sent, ready to send, still to read - #59

Merged
pscheid92 merged 1 commit into
mainfrom
upload-progress-stages
Nov 14, 2026
Merged

pscheid92 merged 1 commit into
mainfrom
upload-progress-stages

Conversation

@pscheid92

Copy link
Copy Markdown
Contributor

A 200 MB upload from a phone looked stuck. Progress only moved when a whole 32 MiB part was stored, and with three parts sharing a slow uplink the bar sat at 0% for minutes, then jumped. Nothing said whether the browser was still encrypting, sending, retrying or paused.

What changes

  • Byte-level progress. Parts go out over XMLHttpRequest, which reports bytes as they are sent. fetch can't report upload progress outside Chromium, and no library helps: axios wraps XHR too, and tus/Uppy need a different server protocol. Errors, retries and cancelling behave as before.
  • Three stages in one bar. Sent, encrypted and ready to send, still to read. They always add up to the bundle, so a long striped middle means the network is the slow side; a thin one means encryption is.
  • One line of numbers. Amounts, rate and time left (averaged over 8 s). It says what is wrong when something is: a part being retried, nothing sent for 8 s, or everything sent but not yet confirmed. Only those notices go to the live region; the bar carries the value.
  • Screen stays on during a file upload (Wake Lock API). A locked phone sends the tab to the background, where the browser stalls it.

The network calls themselves are unchanged: three 32 MiB parts at once. Smaller parts would make a retry on a flaky connection cheaper, but that is a server change.

Checked

  • Typecheck, lint, 246 unit tests: new tests for the XHR wrapper (success, error statuses, lost connection, abort), for progress that nests and ends at the total, for retries resetting sent bytes, and for the rate meter.
  • Playwright suite (17) and static checks against the local stack, before the final layout tidy-up.
  • Throttled 200 MB upload (two files, about 3–5 MB/s up, CPU slowed 4×) in Chromium at 720 and 375 px, light and dark, with the page under the service worker's control.

Not checked yet: a real phone over mobile data.

A 200 MB upload from a phone looked stuck: progress only moved when a
whole 32 MiB part was stored, and with three parts sharing a slow uplink
the bar sat at 0% for minutes, then jumped. Nothing said whether the
browser was still encrypting, sending, retrying or paused.

- Parts go out over XMLHttpRequest, which reports bytes as they are
  sent; fetch cannot report upload progress outside Chromium. Errors,
  retries and cancelling behave as before.
- The upload reports encrypted, sent and stored bytes, plus retries.
  A retried part's sent bytes start over from zero.
- The composer shows one bar in three parts that always add up to the
  bundle: sent, encrypted and ready to send, still to read. One line
  gives the amounts, rate and time left, or says what is wrong
  (retrying, waiting for the network, waiting for the server to
  confirm). Only those notices are announced.
- The screen stays on during a file upload (Wake Lock API), so a phone
  that locks does not push the tab into the background and stall it.

The network calls themselves are unchanged: three 32 MiB parts at once.
@pscheid92
pscheid92 merged commit 31c6e17 into main Nov 14, 2026
7 checks passed
@pscheid92
pscheid92 deleted the upload-progress-stages branch November 14, 2026 19:16
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