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 <noreply@anthropic.com>
This commit is contained in:
parent
eebc8eb9b6
commit
71486f0d43
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"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",
|
"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": {
|
||||||
|
|||||||
@ -3154,11 +3154,6 @@ export default function WeeklyView() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSomedayLists(populatedLists);
|
setSomedayLists(populatedLists);
|
||||||
|
|
||||||
// Roll overdue tasks
|
|
||||||
if (dayTasks.length > 0) {
|
|
||||||
rollOverdueTasks(dayTasks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching data:", error);
|
console.error("Error fetching data:", error);
|
||||||
@ -3462,6 +3457,16 @@ export default function WeeklyView() {
|
|||||||
[profile.autoRolling, cellDuration, endHour, getEventsForDate],
|
[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)
|
// Check if a slot is protected by calendar events (only if slot starts within event time range)
|
||||||
const isSlotProtected = useCallback(
|
const isSlotProtected = useCallback(
|
||||||
(date: Date, slot: string): boolean => {
|
(date: Date, slot: string): boolean => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user