From 1d83595f81fbfcc034c37c2260d695f094f5776e Mon Sep 17 00:00:00 2001
From: soryu <soryu@soryu.co>
Date: Mon, 26 Jan 2026 15:21:10 +0000
Subject: Update supervisor tasks page when supervisor spawns a new task

---
 makima/frontend/src/routes/mesh.tsx | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'makima/frontend/src/routes/mesh.tsx')

diff --git a/makima/frontend/src/routes/mesh.tsx b/makima/frontend/src/routes/mesh.tsx
index fb366a2..cb4a77c 100644
--- a/makima/frontend/src/routes/mesh.tsx
+++ b/makima/frontend/src/routes/mesh.tsx
@@ -148,9 +148,19 @@ export default function MeshPage() {
 
   // Handle task update events from WebSocket
   const handleTaskUpdate = useCallback(async (event: TaskUpdateEvent) => {
-    // Refresh task list if we're viewing the list
-    if (!id) {
+    // Always refresh task list when a new task is created (e.g., by supervisor)
+    // This ensures newly spawned tasks appear in the sidebar immediately
+    const isNewTask = event.updatedFields.includes("created");
+    if (isNewTask) {
       fetchTasks();
+    }
+
+    // Refresh task list if we're viewing the list (no specific task selected)
+    if (!id) {
+      if (!isNewTask) {
+        // Only fetch if we didn't already fetch for new task creation
+        fetchTasks();
+      }
       return;
     }
 
-- 
cgit v1.2.3

