Add debugging logs to syncFromServer
This commit is contained in:
parent
118078fc75
commit
d8f212cff2
@ -55,13 +55,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "2",
|
||||||
"title": "MoodWeave App Idea",
|
"title": "MoodWeave App Idea - UPDATED",
|
||||||
"sprintId": "1771551323429",
|
"sprintId": "1771551323429",
|
||||||
"projectId": "1",
|
"projectId": "1",
|
||||||
"status": "backlog",
|
"status": "backlog",
|
||||||
"priority": "medium",
|
"priority": "high",
|
||||||
"type": "idea",
|
"type": "idea",
|
||||||
"updatedAt": "2026-02-20T02:15:46.591Z"
|
"comments": [],
|
||||||
|
"tags": [
|
||||||
|
"ios",
|
||||||
|
"social"
|
||||||
|
],
|
||||||
|
"createdAt": "2026-02-18T17:01:23.109Z",
|
||||||
|
"updatedAt": "2026-02-20T02:28:23.700Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "3",
|
"id": "3",
|
||||||
@ -450,7 +456,7 @@
|
|||||||
"updatedAt": "2026-02-20T01:52:57.259Z"
|
"updatedAt": "2026-02-20T01:52:57.259Z"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastUpdated": 1771553746591,
|
"lastUpdated": 1771554503700,
|
||||||
"sprints": [
|
"sprints": [
|
||||||
{
|
{
|
||||||
"name": "Sprint 1",
|
"name": "Sprint 1",
|
||||||
|
|||||||
@ -406,14 +406,20 @@ export const useTaskStore = create<TaskStore>()(
|
|||||||
const res = await fetch('/api/tasks')
|
const res = await fetch('/api/tasks')
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json()
|
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) {
|
if (data.tasks?.length > 0 || data.projects?.length > 0 || data.sprints?.length > 0) {
|
||||||
|
console.log('syncFromServer: updating store with server data')
|
||||||
set({
|
set({
|
||||||
projects: data.projects || get().projects,
|
projects: data.projects || get().projects,
|
||||||
tasks: data.tasks || get().tasks,
|
tasks: data.tasks || get().tasks,
|
||||||
sprints: data.sprints || get().sprints,
|
sprints: data.sprints || get().sprints,
|
||||||
lastSynced: Date.now(),
|
lastSynced: Date.now(),
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
console.log('syncFromServer: no data from server, keeping defaults')
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.error('syncFromServer: API returned', res.status)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to sync from server:', error)
|
console.error('Failed to sync from server:', error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user