aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/ui/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/components')
-rw-r--r--packages/ui/src/components/download-monitor.tsx2
-rw-r--r--packages/ui/src/components/instance-creation-modal.tsx5
2 files changed, 3 insertions, 4 deletions
diff --git a/packages/ui/src/components/download-monitor.tsx b/packages/ui/src/components/download-monitor.tsx
index 6916ca5..c6b3442 100644
--- a/packages/ui/src/components/download-monitor.tsx
+++ b/packages/ui/src/components/download-monitor.tsx
@@ -3,7 +3,7 @@ import { useDownloadStore } from "@/stores/download-store";
function formatBytes(bytes: number): string {
if (bytes === 0) return "0 B";
- const units = ["B", "KB", "MB", "GB"];
+ const units = ["B", "KB", "MB", "GB", "TB", "PB"];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
const value = bytes / 1024 ** i;
return `${value.toFixed(value < 10 ? 1 : 0)} ${units[i]}`;
diff --git a/packages/ui/src/components/instance-creation-modal.tsx b/packages/ui/src/components/instance-creation-modal.tsx
index 5b50513..e3fbf23 100644
--- a/packages/ui/src/components/instance-creation-modal.tsx
+++ b/packages/ui/src/components/instance-creation-modal.tsx
@@ -129,9 +129,8 @@ export function InstanceCreationModal({ open, onOpenChange }: Props) {
downloadStore.init();
}
return () => {
- if (!open) {
- downloadStore.cleanup();
- }
+ // Always cleanup event listeners when effect re-runs or unmounts
+ downloadStore.cleanup();
};
}, [open, downloadStore.init, downloadStore.cleanup]);