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/dev-server/src/devtools.ts b/packages/dev-server/src/devtools.ts index 17222d074..8ba43a836 100644 --- a/packages/dev-server/src/devtools.ts +++ b/packages/dev-server/src/devtools.ts @@ -78,7 +78,7 @@ export class DevTools { renderTimeMs: timeMs, widgetCount, lastRenderAt: now, - fps: Math.round(fps * 10) / 10, + fps: Math.round(fps * 10 + Number.EPSILON) / 10, memoryMB: Math.round((process.memoryUsage?.().heapUsed ?? 0) / 1024 / 1024 * 10) / 10, }; } diff --git a/packages/ui/src/Switch.ts b/packages/ui/src/Switch.ts index 7c24941a5..d9a1e01d0 100644 --- a/packages/ui/src/Switch.ts +++ b/packages/ui/src/Switch.ts @@ -114,7 +114,7 @@ export class Switch extends Widget { if (width <= 0) return; const attrs = styleToCellAttrs(this.style); - const knobPos = Math.round(this._animProgress * 2); + const knobPos = Math.round(this._animProgress * 2 + Number.EPSILON); const transitioning = this._animProgress > 0 && this._animProgress < 1; let trackChars: string[];