From 7adcf5b548b2638032f36957889711cf78dbf851 Mon Sep 17 00:00:00 2001
From: krypton <krypton@hydroroll.team>
Date: Tue, 31 Mar 2026 08:59:58 +0800
Subject: fix: resolve cleanup and formatBytes bugs in download progress

---
 packages/ui/src/components/instance-creation-modal.tsx | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'packages/ui/src/components/instance-creation-modal.tsx')

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]);
 
-- 
cgit v1.2.3-70-g09d2

