Skip to content

Commit

Permalink
fix: handle potential undefined size in FilePreview component
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila committed Dec 30, 2024
1 parent a629059 commit 4552711
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/components/Chat/Input/Files/FilePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const FilePreview = ({
}) => {
const radius = 55; // Radius of the SVG circle
const circumference = 2 * Math.PI * radius;
const progress = useProgress(file?.['progress'] ?? 1, 0.001, (file as ExtendedFile).size ?? 1);
const progress = useProgress(
file?.['progress'] ?? 1,
0.001,
(file as ExtendedFile | undefined)?.size ?? 1,
);

// Calculate the offset based on the loading progress
const offset = circumference - progress * circumference;
Expand Down

0 comments on commit 4552711

Please sign in to comment.