fix board context management, cleanup

This commit is contained in:
marlon-erler
2026-04-13 19:45:52 +00:00
parent f16059f91a
commit c2da7f4c9b
19 changed files with 63 additions and 89 deletions
+9 -6
View File
@@ -11,8 +11,6 @@ import { IndexManager } from "../../Model/Utility/utility";
import { CommonKeys } from "../../View/keystrokes";
export default class TaskPageViewModel extends ContextHost<string> {
contextDebugDescription = "task-page";
// data
readonly boardIndexManager = new IndexManager<BoardViewModel>(
(boardViewModel: BoardViewModel) => boardViewModel.name.value,
@@ -145,6 +143,8 @@ export default class TaskPageViewModel extends ContextHost<string> {
// load
loadData = (): void => {
console.log("LOADING TASK PAGE DATA");
this.closeContext();
this.boardViewModels.clear();
const boardIds: string[] = this.boardsAndTasksModel.listBoardIds();
@@ -166,7 +166,7 @@ export default class TaskPageViewModel extends ContextHost<string> {
public readonly chatViewModel: ChatViewModel,
public readonly boardsAndTasksModel: BoardsAndTasksModel,
) {
super();
super("task-page");
this.chatViewModel = chatViewModel;
@@ -174,17 +174,20 @@ export default class TaskPageViewModel extends ContextHost<string> {
this.chatViewModel.registerContext(ChatPageTypes.Tasks, this);
this.selectedBoardId.subscribeSilent(this.updateContexts);
this.loadData();
// handlers
boardsAndTasksModel.boardHandlerManager.addHandler(
(boardInfoFileContent: BoardInfoFileContent) => {
this.showBoardInList(boardInfoFileContent);
this.updateBoardIndices();
this.updateContexts();
},
);
this.chatViewModel.currentContext.subscribeSilent((context) => {
if (!this.isOpen) return;
if (context != this) return;
this.openLastUsedBoard();
});
// keystrokes
this.registerKeyStroke(CommonKeys.Options, this.toggleBoardList);
}