fix: refresh side panel after loadTasks in non-landscape mode
After saveTask or setTaskStatus triggers loadTasks(), the side panel now refreshes from the updated server data. If the selected task no longer exists (deleted or goal changed), the side panel closes. This ensures Edit Task always matches selectedTaskId.
This commit is contained in:
parent
fcee783ee5
commit
5e827e7d99
@ -76,6 +76,22 @@ async function loadTasks() {
|
|||||||
focusEl.classList.add("in-focus");
|
focusEl.classList.add("in-focus");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh side panel if a task was selected
|
||||||
|
if (selectedTaskId) {
|
||||||
|
const currentTask = tasks.find(t => t.id === selectedTaskId);
|
||||||
|
if (currentTask) {
|
||||||
|
document.getElementById("edit-task-title").value = currentTask.title;
|
||||||
|
document.getElementById("edit-task-desc").value = currentTask.desc || "";
|
||||||
|
document.querySelectorAll(".status-btn").forEach(btn => {
|
||||||
|
btn.classList.toggle("active", btn.dataset.status === currentTask.status);
|
||||||
|
});
|
||||||
|
updateSaveButton();
|
||||||
|
} else {
|
||||||
|
closeSidePanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initScrollFocus();
|
initScrollFocus();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user