From b448bf940064d797c809e16395ce444118072a12 Mon Sep 17 00:00:00 2001 From: Flux Labs Date: Sun, 15 Mar 2026 09:56:45 -0500 Subject: [PATCH] feat(ux): terminal width warning and dashboard dispose safety - cli.ts: warn on stderr when terminal is narrower than 40 columns - dashboard-overlay.ts: add disposed flag checked before scheduling refreshes and after async loadData() to prevent rendering on a stopped TUI --- src/resources/extensions/gsd/dashboard-overlay.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/gsd/dashboard-overlay.ts b/src/resources/extensions/gsd/dashboard-overlay.ts index d3e081ca0..410f3db96 100644 --- a/src/resources/extensions/gsd/dashboard-overlay.ts +++ b/src/resources/extensions/gsd/dashboard-overlay.ts @@ -89,6 +89,7 @@ export class GSDDashboardOverlay { private loading = true; private loadedDashboardIdentity?: string; private refreshInFlight: Promise | null = null; + private disposed = false; constructor( tui: { requestRender: () => void }, @@ -108,7 +109,7 @@ export class GSDDashboardOverlay { } private scheduleRefresh(initial = false): void { - if (this.refreshInFlight) return; + if (this.refreshInFlight || this.disposed) return; this.refreshInFlight = this.refreshDashboard(initial) .finally(() => { this.refreshInFlight = null; @@ -136,11 +137,13 @@ export class GSDDashboardOverlay { } private async refreshDashboard(initial = false): Promise { + if (this.disposed) return; this.dashData = getAutoDashboardData(); const nextIdentity = this.computeDashboardIdentity(this.dashData); if (initial || nextIdentity !== this.loadedDashboardIdentity) { const loaded = await this.loadData(); + if (this.disposed) return; if (loaded) { this.loadedDashboardIdentity = nextIdentity; } @@ -529,6 +532,7 @@ export class GSDDashboardOverlay { } dispose(): void { + this.disposed = true; clearInterval(this.refreshTimer); } }