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 => {