Skip to content

Commit 82bd520

Browse files
fix progress not hitting 100%
1 parent 1a602df commit 82bd520

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ export const UploadCapButton = ({
336336

337337
xhr.onload = () => {
338338
if (xhr.status >= 200 && xhr.status < 300) {
339+
setUploadProgress(100);
340+
onProgress?.(uploadId, 100, 100);
339341
sendProgressUpdate(uploadId, uploadState.total, uploadState.total);
340342
resolve();
341343
} else {
@@ -369,13 +371,14 @@ export const UploadCapButton = ({
369371
xhr.upload.onprogress = (event) => {
370372
if (event.lengthComputable) {
371373
const percent = (event.loaded / event.total) * 100;
372-
const thumbnailProgress = 90 + percent * 0.1;
373-
onProgress?.(uploadId, 100, thumbnailProgress);
374+
// Thumbnail upload is a small additional step, keep at 100%
375+
onProgress?.(uploadId, 100, 100);
374376
}
375377
};
376378

377379
xhr.onload = () => {
378380
if (xhr.status >= 200 && xhr.status < 300) {
381+
onProgress?.(uploadId, 100, 100);
379382
resolve();
380383
} else {
381384
reject(
@@ -387,9 +390,10 @@ export const UploadCapButton = ({
387390

388391
xhr.send(screenshotFormData);
389392
});
390-
} else {
391393
}
392394

395+
// Final progress update to ensure we're at 100%
396+
setUploadProgress(100);
393397
onProgress?.(uploadId, 100, 100);
394398
onComplete?.(uploadId);
395399
router.refresh();

0 commit comments

Comments
 (0)