Fix: Always load server data on refresh, don't keep defaults

This commit is contained in:
OpenClaw Bot 2026-02-19 20:55:49 -06:00
parent d8f212cff2
commit 6ef31132b6
2 changed files with 8 additions and 12 deletions

View File

@ -456,7 +456,7 @@
"updatedAt": "2026-02-20T01:52:57.259Z"
}
],
"lastUpdated": 1771554503700,
"lastUpdated": 1771555515806,
"sprints": [
{
"name": "Sprint 1",

View File

@ -407,17 +407,13 @@ export const useTaskStore = create<TaskStore>()(
if (res.ok) {
const data = await res.json()
console.log('syncFromServer: fetched', data.tasks?.length, 'tasks')
if (data.tasks?.length > 0 || data.projects?.length > 0 || data.sprints?.length > 0) {
console.log('syncFromServer: updating store with server data')
set({
projects: data.projects || get().projects,
tasks: data.tasks || get().tasks,
sprints: data.sprints || get().sprints,
lastSynced: Date.now(),
})
} else {
console.log('syncFromServer: no data from server, keeping defaults')
}
// ALWAYS use server data if API returns successfully
set({
projects: data.projects || [],
tasks: data.tasks || [],
sprints: data.sprints || [],
lastSynced: Date.now(),
})
} else {
console.error('syncFromServer: API returned', res.status)
}