Skip to content

Commit b8afba4

Browse files
committed
Add hasRawFallback to upload progress flow
1 parent 9bc82be commit b8afba4

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,12 @@ export const CapCard = ({
213213
cap.id,
214214
cap.hasActiveUpload || false,
215215
);
216+
const hasRawFallback =
217+
uploadProgress?.status === "error" && uploadProgress.hasRawFallback;
216218
const hasVisibleUploadProgress =
217-
uploadProgress !== null && uploadProgress.status !== "fetching";
219+
uploadProgress !== null &&
220+
uploadProgress.status !== "fetching" &&
221+
!hasRawFallback;
218222
const [imageStatus, setImageStatus] = useState<ImageLoadingStatus>("loading");
219223
const prevUploadProgressRef = useRef(uploadProgress);
220224

apps/web/app/s/[videoId]/_components/ProgressCircle.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type UploadProgress =
2727
status: "error";
2828
lastUpdated: Date;
2929
errorMessage: string | null;
30+
hasRawFallback: boolean;
3031
}
3132
| {
3233
status: "failed";
@@ -157,6 +158,7 @@ export function useUploadProgress(
157158
status: "error",
158159
lastUpdated,
159160
errorMessage: Option.getOrNull(query.data.processingError),
161+
hasRawFallback: query.data.hasRawFallback,
160162
};
161163
}
162164

@@ -165,6 +167,7 @@ export function useUploadProgress(
165167
status: "error",
166168
lastUpdated,
167169
errorMessage: stalledProcessingMessage,
170+
hasRawFallback: query.data.hasRawFallback,
168171
};
169172
}
170173

packages/web-backend/src/Videos/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export class Videos extends Effect.Service<Videos>()("Videos", {
290290
processingProgress: Db.videoUploads.processingProgress,
291291
processingMessage: Db.videoUploads.processingMessage,
292292
processingError: Db.videoUploads.processingError,
293+
rawFileKey: Db.videoUploads.rawFileKey,
293294
})
294295
.from(Db.videoUploads)
295296
.where(Dz.eq(Db.videoUploads.videoId, videoId)),
@@ -307,6 +308,7 @@ export class Videos extends Effect.Service<Videos>()("Videos", {
307308
processingProgress: result.processingProgress,
308309
processingMessage: Option.fromNullable(result.processingMessage),
309310
processingError: Option.fromNullable(result.processingError),
311+
hasRawFallback: result.rawFileKey != null,
310312
}),
311313
);
312314
}),

packages/web-domain/src/Video.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export class UploadProgress extends Schema.Class<UploadProgress>(
7878
processingProgress: Schema.Int.pipe(Schema.greaterThanOrEqualTo(0)),
7979
processingMessage: Schema.OptionFromNullOr(Schema.String),
8080
processingError: Schema.OptionFromNullOr(Schema.String),
81+
hasRawFallback: Schema.Boolean,
8182
}) {}
8283

8384
export const UploadProgressUpdateInput = Schema.Struct({

0 commit comments

Comments
 (0)