Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix progress meter
  • Loading branch information
regalijan committed Mar 27, 2024
1 parent f8e19b8 commit cbfa13e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/routes/report.tsx
Expand Up @@ -184,8 +184,9 @@ export default function () {
xhr.upload.onprogress = (e) => {
if (!e.lengthComputable) return;

bytesRead += e.loaded;
setFileProgress(Math.floor((bytesRead / totalSize) * 100));
setFileProgress(
Math.floor(((bytesRead + e.loaded) / totalSize) * 100),
);
};
xhr.upload.onabort = () => {
shouldRecall = true;
Expand All @@ -197,9 +198,11 @@ export default function () {
setUploading(false);
setFileProgress(0);
};
xhr.upload.onloadend = () => {
xhr.upload.onloadend = (ev) => {
if (i === upload_urls.length - 1) setUploading(false);

bytesRead += ev.total;
setFileProgress(bytesRead);
resolve(null);
};

Expand Down

0 comments on commit cbfa13e

Please sign in to comment.