fix(tui): reload todos when switching sessions or navigating tree

This commit is contained in:
can1357
2026-01-12 07:15:39 +01:00
parent 7f459214c1
commit 66ea245f2d
5 changed files with 15 additions and 0 deletions
@@ -376,6 +376,7 @@ export class CommandController {
this.ctx.chatContainer.addChild(
new Text(`${theme.fg("accent", `${theme.status.success} New session started`)}`, 1, 1),
);
await this.ctx.reloadTodos();
this.ctx.ui.requestRender();
}
@@ -141,6 +141,7 @@ export class ExtensionUiController {
this.ctx.chatContainer.addChild(
new Text(`${theme.fg("accent", `${theme.status.success} New session started`)}`, 1, 1),
);
await this.ctx.reloadTodos();
this.ctx.ui.requestRender();
return { cancelled: false };
@@ -154,6 +155,7 @@ export class ExtensionUiController {
// Update UI
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
this.ctx.editor.setText(result.selectedText);
this.ctx.showStatus("Branched to new session");
@@ -168,6 +170,7 @@ export class ExtensionUiController {
// Update UI
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
if (result.editorText) {
this.ctx.editor.setText(result.editorText);
}
@@ -289,6 +292,7 @@ export class ExtensionUiController {
this.ctx.chatContainer.addChild(
new Text(`${theme.fg("accent", `${theme.status.success} New session started`)}`, 1, 1),
);
await this.ctx.reloadTodos();
this.ctx.ui.requestRender();
return { cancelled: false };
@@ -305,6 +309,7 @@ export class ExtensionUiController {
// Update UI
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
this.ctx.editor.setText(result.selectedText);
this.ctx.showStatus("Branched to new session");
@@ -322,6 +327,7 @@ export class ExtensionUiController {
// Update UI
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
if (result.editorText) {
this.ctx.editor.setText(result.editorText);
}
@@ -428,6 +428,7 @@ export class SelectorController {
// Update UI
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
if (result.editorText) {
this.ctx.editor.setText(result.editorText);
}
@@ -500,6 +501,7 @@ export class SelectorController {
// Clear and re-render the chat
this.ctx.chatContainer.clear();
this.ctx.renderInitialMessages();
await this.ctx.reloadTodos();
this.ctx.showStatus("Resumed session");
}
@@ -757,6 +757,11 @@ export class InteractiveMode implements InteractiveModeContext {
this.ui.requestRender();
}
async reloadTodos(): Promise<void> {
await this.loadTodoList();
this.ui.requestRender();
}
openExternalEditor(): void {
this.inputController.openExternalEditor();
}
@@ -124,6 +124,7 @@ export interface InteractiveModeContext {
updateEditorBorderColor(): void;
rebuildChatFromMessages(): void;
setTodos(todos: TodoItem[]): void;
reloadTodos(): Promise<void>;
toggleTodoExpansion(): void;
// Command handling