mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 15:04:52 +00:00
Fix components not rebuilding content on theme change
This commit is contained in:
parent
36fbce85c2
commit
45a6c394ca
7 changed files with 39 additions and 0 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
## [0.39.1] - 2026-01-08
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||||
export class AssistantMessageComponent extends Container {
|
export class AssistantMessageComponent extends Container {
|
||||||
private contentContainer: Container;
|
private contentContainer: Container;
|
||||||
private hideThinkingBlock: boolean;
|
private hideThinkingBlock: boolean;
|
||||||
|
private lastMessage?: AssistantMessage;
|
||||||
|
|
||||||
constructor(message?: AssistantMessage, hideThinkingBlock = false) {
|
constructor(message?: AssistantMessage, hideThinkingBlock = false) {
|
||||||
super();
|
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 {
|
setHideThinkingBlock(hide: boolean): void {
|
||||||
this.hideThinkingBlock = hide;
|
this.hideThinkingBlock = hide;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateContent(message: AssistantMessage): void {
|
updateContent(message: AssistantMessage): void {
|
||||||
|
this.lastMessage = message;
|
||||||
|
|
||||||
// Clear content container
|
// Clear content container
|
||||||
this.contentContainer.clear();
|
this.contentContainer.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,11 @@ export class BashExecutionComponent extends Container {
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override invalidate(): void {
|
||||||
|
super.invalidate();
|
||||||
|
this.updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
appendOutput(chunk: string): void {
|
appendOutput(chunk: string): void {
|
||||||
// Strip ANSI codes and normalize line endings
|
// Strip ANSI codes and normalize line endings
|
||||||
// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand
|
// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ export class BranchSummaryMessageComponent extends Box {
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override invalidate(): void {
|
||||||
|
super.invalidate();
|
||||||
|
this.updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
private updateDisplay(): void {
|
private updateDisplay(): void {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ export class CompactionSummaryMessageComponent extends Box {
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override invalidate(): void {
|
||||||
|
super.invalidate();
|
||||||
|
this.updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
private updateDisplay(): void {
|
private updateDisplay(): void {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ export class CustomMessageComponent extends Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override invalidate(): void {
|
||||||
|
super.invalidate();
|
||||||
|
this.rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
private rebuild(): void {
|
private rebuild(): void {
|
||||||
// Remove previous content component
|
// Remove previous content component
|
||||||
if (this.customComponent) {
|
if (this.customComponent) {
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,11 @@ export class ToolExecutionComponent extends Container {
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override invalidate(): void {
|
||||||
|
super.invalidate();
|
||||||
|
this.updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
private updateDisplay(): void {
|
private updateDisplay(): void {
|
||||||
// Set background based on state
|
// Set background based on state
|
||||||
const bgFn = this.isPartial
|
const bgFn = this.isPartial
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue