diff --git a/server/src/ledgrab/static/js/core/api.ts b/server/src/ledgrab/static/js/core/api.ts index f186ec1..02a25fe 100644 --- a/server/src/ledgrab/static/js/core/api.ts +++ b/server/src/ledgrab/static/js/core/api.ts @@ -344,6 +344,13 @@ export async function loadServerInfo() { uptimeSec: data.uptime_seconds, 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 diff --git a/server/src/ledgrab/templates/index.html b/server/src/ledgrab/templates/index.html index 63a6821..d968bd6 100644 --- a/server/src/ledgrab/templates/index.html +++ b/server/src/ledgrab/templates/index.html @@ -570,6 +570,9 @@ } render(); 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