From 71486f0d432f25f5ed7d366333fb118731a92e80 Mon Sep 17 00:00:00 2001 From: mARTin Date: Tue, 17 Mar 2026 01:08:15 +0100 Subject: [PATCH] fix: rolling tasks not moving to today due to profile load race condition Rolling ran inside fetchTasks before profile.autoRolling was loaded, so it always saw false and skipped. Now runs as a dedicated effect that waits for both profile and tasks to be ready. v1.39.1 Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/components/WeeklyView.tsx | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bbebd38..9c54bd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.39.0", + "version": "1.39.1", "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": { diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index 7af0f04..805a316 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -3154,11 +3154,6 @@ export default function WeeklyView() { } setSomedayLists(populatedLists); - - // Roll overdue tasks - if (dayTasks.length > 0) { - rollOverdueTasks(dayTasks); - } } } catch (error) { console.error("Error fetching data:", error); @@ -3462,6 +3457,16 @@ export default function WeeklyView() { [profile.autoRolling, cellDuration, endHour, getEventsForDate], ); + // Run rolling after profile is loaded and tasks are available + const rollingRanRef = useRef(false); + useEffect(() => { + if (rollingRanRef.current) return; + if (!profile.autoRolling) return; + if (tasks.length === 0) return; + rollingRanRef.current = true; + rollOverdueTasks(tasks); + }, [profile.autoRolling, tasks, rollOverdueTasks]); + // Check if a slot is protected by calendar events (only if slot starts within event time range) const isSlotProtected = useCallback( (date: Date, slot: string): boolean => {