Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

if uploaded >= video total, assume upload is complete

Brendan Allanf5ea99057ab1
diff --git a/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx b/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
index 156565c15..2e6e5155f 100644
--- a/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
+++ b/apps/web/app/s/[videoId]/_components/ProgressCircle.tsx
@@ -51,20 +51,22 @@ export function useUploadProgress(
const lastUpdated = new Date(query.data.updatedAt);
- return Date.now() - lastUpdated.getTime() > 5 * MINUTE
- ? {
- status: "failed",
- lastUpdated,
- }
- : {
- status: "uploading",
- lastUpdated,
- progress:
- // `0/0` for progress is `NaN`
- query.data.total === 0
- ? 0
- : (query.data.uploaded / query.data.total) * 100,
- };
+ return query.data.uploaded >= query.data.total
+ ? null
+ : Date.now() - lastUpdated.getTime() > 5 * MINUTE
+ ? {
+ status: "failed",
+ lastUpdated,
+ }
+ : {
+ status: "uploading",
+ lastUpdated,
+ progress:
+ // `0/0` for progress is `NaN`
+ query.data.total === 0
+ ? 0
+ : (query.data.uploaded / query.data.total) * 100,
+ };
}
const ProgressCircle = ({