From 6d995b9aafbc481678a6fbd9a79e179c7d9d763b Mon Sep 17 00:00:00 2001 From: Anso Date: Mon, 25 May 2026 12:10:48 -0400 Subject: [PATCH] fix(dashboard): slow HealthStatusBar sync-label tick to 5s (#1211) useTicker(1000) rendered the masthead once per second to advance the "last sync Xs" label. The label only shifts visibly every few seconds (1s, 6s, 11s..., then m, then h), so the per-second cadence forced the entire dashboard tree through the React reconciler 60 times per minute for a visual change the eye does not see. A 5s tick keeps the label fresh while cutting the wake-up rate by 5x. Name the constant so the trade-off is documented at the call site. --- frontend/src/components/dashboard/HealthStatusBar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/dashboard/HealthStatusBar.tsx b/frontend/src/components/dashboard/HealthStatusBar.tsx index 882ae6a5..b61e7e63 100644 --- a/frontend/src/components/dashboard/HealthStatusBar.tsx +++ b/frontend/src/components/dashboard/HealthStatusBar.tsx @@ -88,6 +88,11 @@ function useTicker(intervalMs: number): number { return now; } +// The "last sync Xs" label only shifts visibly every few seconds, so a 5 s +// re-render cadence keeps the freshness signal accurate without forcing the +// dashboard tree through the reconciler once per second. +const SYNC_LABEL_TICK_MS = 5000; + export function HealthStatusBar({ stats, systemStats, @@ -101,7 +106,7 @@ export function HealthStatusBar({ [stats, systemStats, notifications], ); const config = healthConfig[level]; - const now = useTicker(1000); + const now = useTicker(SYNC_LABEL_TICK_MS); const unreadAlerts = notifications.filter(n => !n.is_read).length; const running = `${stats.active}/${stats.total}`; const cpuLabel = systemStats ? `${parseFloat(systemStats.cpu.usage).toFixed(0)}%` : '--';