Fix components not rebuilding content on theme change

This commit is contained in:
Mario Zechner 2026-01-09 00:40:57 +01:00
parent 36fbce85c2
commit 45a6c394ca
7 changed files with 39 additions and 0 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Components now properly rebuild their content on theme change (tool executions, assistant messages, bash executions, custom messages, branch/compaction summaries)
## [0.39.1] - 2026-01-08
### Fixed

View file

@ -8,6 +8,7 @@ import { getMarkdownTheme, theme } from "../theme/theme.js";
export class AssistantMessageComponent extends Container {
private contentContainer: Container;
private hideThinkingBlock: boolean;
private lastMessage?: AssistantMessage;
constructor(message?: AssistantMessage, hideThinkingBlock = false) {
super();
@ -23,11 +24,20 @@ export class AssistantMessageComponent extends Container {
}
}
override invalidate(): void {
super.invalidate();
if (this.lastMessage) {
this.updateContent(this.lastMessage);
}
}
setHideThinkingBlock(hide: boolean): void {
this.hideThinkingBlock = hide;
}
updateContent(message: AssistantMessage): void {
this.lastMessage = message;
// Clear content container
this.contentContainer.clear();

View file

@ -73,6 +73,11 @@ export class BashExecutionComponent extends Container {
this.updateDisplay();
}
override invalidate(): void {
super.invalidate();
this.updateDisplay();
}
appendOutput(chunk: string): void {
// Strip ANSI codes and normalize line endings
// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand

View file

@ -21,6 +21,11 @@ export class BranchSummaryMessageComponent extends Box {
this.updateDisplay();
}
override invalidate(): void {
super.invalidate();
this.updateDisplay();
}
private updateDisplay(): void {
this.clear();

View file

@ -21,6 +21,11 @@ export class CompactionSummaryMessageComponent extends Box {
this.updateDisplay();
}
override invalidate(): void {
super.invalidate();
this.updateDisplay();
}
private updateDisplay(): void {
this.clear();

View file

@ -36,6 +36,11 @@ export class CustomMessageComponent extends Container {
}
}
override invalidate(): void {
super.invalidate();
this.rebuild();
}
private rebuild(): void {
// Remove previous content component
if (this.customComponent) {

View file

@ -219,6 +219,11 @@ export class ToolExecutionComponent extends Container {
this.updateDisplay();
}
override invalidate(): void {
super.invalidate();
this.updateDisplay();
}
private updateDisplay(): void {
// Set background based on state
const bgFn = this.isPartial