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:
parent
a009a4953a
commit
8402adbd45
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"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",
|
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -86,14 +86,16 @@ export async function GET(req: NextRequest) {
|
|||||||
for (const listId of googleListIds) {
|
for (const listId of googleListIds) {
|
||||||
const localTasks = googleByList.get(listId) || [];
|
const localTasks = googleByList.get(listId) || [];
|
||||||
try {
|
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;
|
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 maxSyncDate = localTasks.reduce((max, t) => {
|
||||||
const d = t.lastSyncedAt || t.updatedAt;
|
const d = t.lastSyncedAt || t.updatedAt;
|
||||||
return d > max ? d : max;
|
return d > max ? d : max;
|
||||||
}, new Date(0));
|
}, new Date(0));
|
||||||
// Subtract 1 minute buffer to avoid missing edge cases
|
|
||||||
updatedMin = new Date(maxSyncDate.getTime() - 60000).toISOString();
|
updatedMin = new Date(maxSyncDate.getTime() - 60000).toISOString();
|
||||||
}
|
}
|
||||||
const remoteTasks = await fetchGoogleTasksForSync(client, listId, updatedMin);
|
const remoteTasks = await fetchGoogleTasksForSync(client, listId, updatedMin);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user