From 30d8d7022babf8e1181d5abc54efdc12110a12f9 Mon Sep 17 00:00:00 2001 From: OpenClaw Bot Date: Thu, 19 Feb 2026 21:01:11 -0600 Subject: [PATCH] Add detailed logging to updateTask and syncToServer --- data/tasks.json | 2 +- src/stores/useTaskStore.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/data/tasks.json b/data/tasks.json index 7e6ade2..823d444 100644 --- a/data/tasks.json +++ b/data/tasks.json @@ -456,7 +456,7 @@ "updatedAt": "2026-02-20T01:52:57.259Z" } ], - "lastUpdated": 1771555515806, + "lastUpdated": 1771556223745, "sprints": [ { "name": "Sprint 1", diff --git a/src/stores/useTaskStore.ts b/src/stores/useTaskStore.ts index 8e7696c..a491a03 100644 --- a/src/stores/useTaskStore.ts +++ b/src/stores/useTaskStore.ts @@ -377,12 +377,20 @@ const defaultTasks: Task[] = [ // Helper to sync to server async function syncToServer(projects: Project[], tasks: Task[], sprints: Sprint[]) { + console.log('syncToServer: saving', tasks.length, 'tasks') + const t2 = tasks.find(t => t.id === '2') + if (t2) console.log('syncToServer: task 2 sprintId:', t2.sprintId) try { - await fetch('/api/tasks', { + const res = await fetch('/api/tasks', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ projects, tasks, sprints }), }) + if (res.ok) { + console.log('syncToServer: saved successfully') + } else { + console.error('syncToServer: failed with status', res.status) + } } catch (error) { console.error('Failed to sync to server:', error) } @@ -489,10 +497,13 @@ export const useTaskStore = create()( }, updateTask: (id, updates) => { + console.log('updateTask called:', id, updates) set((state) => { const newTasks = state.tasks.map((t) => t.id === id ? { ...t, ...updates, updatedAt: new Date().toISOString() } : t ) + const updatedTask = newTasks.find(t => t.id === id) + console.log('updateTask: updated task:', updatedTask) syncToServer(state.projects, newTasks, state.sprints) return { tasks: newTasks } })