From b3ca03f36291abc00b7c65d989dd1bfbde6d0245 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Wed, 5 Aug 2026 16:54:58 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/rss-reader/src/index.tsx | 2 +- examples/weather/src/index.tsx | 2 +- packages/ui/src/prompts.ts | 2 +- scripts/build-registry.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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 diff --git a/packages/ui/src/prompts.ts b/packages/ui/src/prompts.ts index b92bb28ba..06a6845f0 100644 --- a/packages/ui/src/prompts.ts +++ b/packages/ui/src/prompts.ts @@ -69,7 +69,7 @@ async function promptText(options: TextPromptOptions): Promise { async function promptConfirm(options: ConfirmPromptOptions): Promise { if (!process.stdin.isTTY) throw new NonInteractiveError(); - const hint = options.default === true ? 'Y/n' : options.default === false ? 'y/N' : 'y/n'; + const hint = options.default ? 'Y/n' : options.default === false ? 'y/N' : 'y/n'; return new Promise((resolve) => { const rl = readline.createInterface({ diff --git a/scripts/build-registry.ts b/scripts/build-registry.ts index f84844538..01abfbde1 100644 --- a/scripts/build-registry.ts +++ b/scripts/build-registry.ts @@ -44,7 +44,7 @@ export function collectDeps(content: string): string[] { const deps = new Set(); let m: RegExpExecArray | null; while ((m = re.exec(content)) !== null) deps.add(m[1]!); - return [...deps].sort(); + return [...deps].sort((a, b) => a - b); } export function toSlug(name: string): string {