fix(sync): resolve drag-and-drop sync gap for Someday lists
This commit is contained in:
parent
eb5a4b4232
commit
210a142f61
@ -4607,6 +4607,47 @@ export default function WeeklyView() {
|
|||||||
}).catch((e) =>
|
}).catch((e) =>
|
||||||
console.error("Sync error:", e),
|
console.error("Sync error:", e),
|
||||||
);
|
);
|
||||||
|
} else if (list.externalProvider) {
|
||||||
|
// If target list is synced but task is not, push it
|
||||||
|
fetch("/api/tasks/sync", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
taskId: taskToMove.id,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.then(async (r) => {
|
||||||
|
if (r.ok) {
|
||||||
|
const syncData = await r.json();
|
||||||
|
if (syncData.task) {
|
||||||
|
// Update local state with external IDs
|
||||||
|
setSomedayLists((prev) =>
|
||||||
|
prev.map((l) =>
|
||||||
|
l.id === list.id
|
||||||
|
? {
|
||||||
|
...l,
|
||||||
|
tasks: l.tasks.map(
|
||||||
|
(t) =>
|
||||||
|
t.id ===
|
||||||
|
taskToMove.id
|
||||||
|
? {
|
||||||
|
...t,
|
||||||
|
...syncData.task,
|
||||||
|
}
|
||||||
|
: t,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
: l,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) =>
|
||||||
|
console.error("Sync push error:", e),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user