From f021395773a14228ce06a223b8532810e50cf5bc Mon Sep 17 00:00:00 2001 From: Yuyao Huang Date: Sat, 9 May 2026 13:59:57 +0800 Subject: [PATCH] fix: ensure scroll position is restored before initializing scroll focus Move initScrollFocus() after scrollToTask() to prevent handleScrollFocus() from incorrectly updating selected_task_id before the saved position is restored --- static/js/tasks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/tasks.js b/static/js/tasks.js index ae9f958..ec830f3 100644 --- a/static/js/tasks.js +++ b/static/js/tasks.js @@ -42,7 +42,6 @@ async function loadTasks() { renderTasks(); initSortable(); - initScrollFocus(); const currentGoal = goals.find(g => g.id === selectedGoalId); const savedTaskId = currentGoal ? currentGoal.selected_task_id : null; @@ -64,6 +63,8 @@ async function loadTasks() { selectTask(tasks[0].id); } } + + initScrollFocus(); } catch (error) { console.error("Failed to load tasks:", error); }