From b88b8b3b3b8c4d2ad609d4f520424dd8463e4c01 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 14:03:36 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/calculator/src/index.tsx | 2 +- examples/weather/src/index.tsx | 2 +- packages/ui/src/TreeSelect.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/calculator/src/index.tsx b/examples/calculator/src/index.tsx index 852911990..328248060 100644 --- a/examples/calculator/src/index.tsx +++ b/examples/calculator/src/index.tsx @@ -85,7 +85,7 @@ function safeEval(expr: string): string { if (tokens.length === 0) return '0'; // Handle initial negative number - if (tokens[0] === '-' && tokens.length > 1 && !isNaN(Number(tokens[1]))) { + if (tokens[0] === '-' && tokens.length > 1 && !Number.isNaN(Number(tokens[1]))) { tokens.splice(0, 2, '-' + tokens[1]); } 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 diff --git a/packages/ui/src/TreeSelect.ts b/packages/ui/src/TreeSelect.ts index 652ede256..2c3a59a97 100644 --- a/packages/ui/src/TreeSelect.ts +++ b/packages/ui/src/TreeSelect.ts @@ -182,7 +182,7 @@ function _pathsEqual(a: number[], b: number[]): boolean { function _valuesEqual(a: string[], b: string[]): boolean { if (a.length !== b.length) return false; - const sortedA = [...a].sort(); + const sortedA = [...a].sort((a, b) => a - b); const sortedB = [...b].sort(); for (let i = 0; i < sortedA.length; i++) { if (sortedA[i] !== sortedB[i]) return false;