fix(ui): repaint transport-bar uptime as soon as /health responds

The inline transport-uptime ticker only repainted on its 1 s setInterval,
so the field could sit on - for up to ~1 s after page load (and much
longer if init's first /health response landed between ticks - the next
seed then had to wait for the 10 s connection-monitor poll). Dispatch a
serverUptimeChanged DOM event when window.__serverUptime is seeded and
let the inline IIFE re-render on receipt, so the value appears as soon
as the response arrives.
This commit is contained in:
2026-05-16 12:28:57 +03:00
parent 17684afba1
commit f1b0f0eab2
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -344,6 +344,13 @@ export async function loadServerInfo() {
uptimeSec: data.uptime_seconds, uptimeSec: data.uptime_seconds,
recordedAtPerf: performance.now(), recordedAtPerf: performance.now(),
}; };
// Wake the inline transport-uptime ticker immediately instead of
// waiting up to a full second for its setInterval tick. Without
// this nudge the field can stay on "—" for ~1 s after page load
// (and up to 10 s if init's first /health response arrives just
// after a tick and the user has to wait for the next connection-
// monitor poll to seed it).
document.dispatchEvent(new CustomEvent('serverUptimeChanged'));
} }
// Demo mode detection // Demo mode detection
+3
View File
@@ -570,6 +570,9 @@
} }
render(); render();
setInterval(render, 1000); setInterval(render, 1000);
// Repaint as soon as api.ts seeds window.__serverUptime, so the
// field doesn't have to wait up to a second for the next tick.
document.addEventListener('serverUptimeChanged', render);
})(); })();
// Transport-bar poll-interval control — cycles through 1/2/5/10s // Transport-bar poll-interval control — cycles through 1/2/5/10s