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(
|
||||||
@ -4709,11 +4750,11 @@ export default function WeeklyView() {
|
|||||||
style={{ display: "inline-flex", alignItems: "center", marginLeft: "4px", opacity: 0.5, flexShrink: 0 }}
|
style={{ display: "inline-flex", alignItems: "center", marginLeft: "4px", opacity: 0.5, flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
{list.externalProvider === "outlook" ? (
|
{list.externalProvider === "outlook" ? (
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="3" width="20" height="18" rx="2"/><path d="M7 3v18"/><path d="M7 8h10"/><path d="M7 13h10"/></svg>
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="3" width="20" height="18" rx="2" /><path d="M7 3v18" /><path d="M7 8h10" /><path d="M7 13h10" /></svg>
|
||||||
) : list.externalProvider === "google" ? (
|
) : list.externalProvider === "google" ? (
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 8v8"/><path d="M8 12h8"/></svg>
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10" /><path d="M12 8v8" /><path d="M8 12h8" /></svg>
|
||||||
) : list.externalProvider === "apple" ? (
|
) : list.externalProvider === "apple" ? (
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.8-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83"/><path d="M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11"/></svg>
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.8-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83" /><path d="M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11" /></svg>
|
||||||
) : (
|
) : (
|
||||||
<RefreshCcw size={12} />
|
<RefreshCcw size={12} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user