fix: always full-fetch Google Tasks for linked someday lists

The updatedMin optimization skipped tasks that were missed during
initial sync. Now does a full fetch when a someday list is linked,
ensuring all remote tasks are discovered.

v1.57.13

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-23 01:35:56 +01:00
parent a009a4953a
commit 8402adbd45
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "my-weekly-todo-list",
"version": "1.57.12",
"version": "1.57.13",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js",
"scripts": {

View File

@ -86,14 +86,16 @@ export async function GET(req: NextRequest) {
for (const listId of googleListIds) {
const localTasks = googleByList.get(listId) || [];
try {
// Use updatedMin to only fetch tasks changed since last sync
// Use updatedMin only when there's no linked someday list
// (i.e. only updating existing tasks). When a list is linked,
// always do a full fetch to discover any missing tasks.
let updatedMin: string | undefined;
if (localTasks.length > 0) {
const hasSomedayList = listIdToSomedayList.has(listId);
if (localTasks.length > 0 && !hasSomedayList) {
const maxSyncDate = localTasks.reduce((max, t) => {
const d = t.lastSyncedAt || t.updatedAt;
return d > max ? d : max;
}, new Date(0));
// Subtract 1 minute buffer to avoid missing edge cases
updatedMin = new Date(maxSyncDate.getTime() - 60000).toISOString();
}
const remoteTasks = await fetchGoogleTasksForSync(client, listId, updatedMin);