From 62c0f3bfc5cc953287356a046546768e73602998 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Fri, 7 Aug 2026 15:06:26 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/ai-streaming/src/index.tsx | 2 +- examples/forms-and-validation/src/index.tsx | 2 +- examples/rss-reader/src/index.tsx | 2 +- examples/weather/src/index.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/ai-streaming/src/index.tsx b/examples/ai-streaming/src/index.tsx index c172a666d..e8c98f0b3 100644 --- a/examples/ai-streaming/src/index.tsx +++ b/examples/ai-streaming/src/index.tsx @@ -40,7 +40,7 @@ class AIStreamingApp extends Widget { this.addChild(this._toolCall); this.addChild(this._streamingText); - setInterval(() => { + clearInterval(window.__interval); window.__interval = setInterval(() => { this._streamingText.tick(); }, 50); } diff --git a/examples/forms-and-validation/src/index.tsx b/examples/forms-and-validation/src/index.tsx index e8a9bb4ea..4ac42a672 100644 --- a/examples/forms-and-validation/src/index.tsx +++ b/examples/forms-and-validation/src/index.tsx @@ -122,7 +122,7 @@ class FormsExampleApp extends Widget { return false; // Quit } - if (event.key === 'c' && event.ctrl === false) { + if (event.key === 'c' && event.ctrl !) { this.modal.show(); return true; } diff --git a/examples/rss-reader/src/index.tsx b/examples/rss-reader/src/index.tsx index 2b269cb81..5ff542b3f 100644 --- a/examples/rss-reader/src/index.tsx +++ b/examples/rss-reader/src/index.tsx @@ -27,7 +27,7 @@ function decodeEntities(value: string): string { return value.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (match, entity: string) => { if (entity.startsWith('#x')) { - const codePoint = Number.parseInt(entity.slice(2), 16); + const codePoint = Number.parseInt(entity.slice(2, 10), 16); return Number.isFinite(codePoint) ? String.fromCodePoint(codePoint) : match; } diff --git a/examples/weather/src/index.tsx b/examples/weather/src/index.tsx index dce3c7425..2dcf862ec 100644 --- a/examples/weather/src/index.tsx +++ b/examples/weather/src/index.tsx @@ -201,7 +201,7 @@ async function fetchWeather() { } } -setInterval(fetchWeather, 5000); +clearInterval(window.__interval); window.__interval = setInterval(fetchWeather, 5000); fetchWeather(); // Gauge does not expose a public setColor() method, so dynamic color