fix: 'stations on air' widget updates instantly after a QSO (UDP/FT8 path now emits qso:logged; publishLiveStatus emits livestatus:updated so the widget re-reads exactly when the shared row changes) — was lagging ~15-45s behind the ON-AIR badge

This commit is contained in:
2026-07-21 11:32:16 +02:00
parent d9b7e48e83
commit a2958d458e
3 changed files with 27 additions and 2 deletions
+6 -2
View File
@@ -452,9 +452,13 @@ export default function App() {
const load = () => GetLiveStations().then((s) => setLiveStations((s ?? []) as LiveStation[])).catch(() => {});
load();
const id = window.setInterval(load, 5 * 1000);
// Small delay lets the async publishLiveStatus MySQL write land before we read.
// Refresh the instant the backend actually publishes a row change (a QSO put
// someone on air, or a 5-min silence took them off) — so this widget tracks the
// bottom ON-AIR badge instead of lagging behind its poll. Keep the qso:logged
// fallback too (a small delay lets the async publish land) for older paths.
const offStatus = EventsOn('livestatus:updated', load);
const offLogged = EventsOn('qso:logged', () => { window.setTimeout(load, 1500); });
return () => { window.clearInterval(id); offLogged?.(); };
return () => { window.clearInterval(id); offStatus?.(); offLogged?.(); };
}, [liveStationsOn]);
// Mode OpsLog shows when the rig reports generic DIG_U/DIG_L. OmniRig
// can't tell us if it's FT8 vs FT4 vs RTTY, so the user picks the default