From 9a16c14b7fde683eb41526085c15852c69bed5e5 Mon Sep 17 00:00:00 2001
From: HsiangNianian <i@jyunko.cn>
Date: Sun, 18 Jan 2026 13:05:29 +0800
Subject: refactor: move version refresh logic to App.svelte and clean up
 GameState constructor

---
 ui/src/App.svelte | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'ui/src/App.svelte')

diff --git a/ui/src/App.svelte b/ui/src/App.svelte
index 127bbea..f73e0a2 100644
--- a/ui/src/App.svelte
+++ b/ui/src/App.svelte
@@ -48,6 +48,15 @@
     window.addEventListener("mousemove", handleMouseMove);
   });
 
+  // Refresh versions when active instance changes
+  $effect(() => {
+    if (instancesState.activeInstanceId) {
+      gameState.loadVersions();
+    } else {
+      gameState.versions = [];
+    }
+  });
+
   onDestroy(() => {
     if (typeof window !== 'undefined')
       window.removeEventListener("mousemove", handleMouseMove);
-- 
cgit v1.2.3-70-g09d2

