fix: serverInfo page shows data immediately on load
Eliminated redundant serverinfo RCON polling from the serverInfo page. It now subscribes to the header's serverinfo-update CustomEvent instead. Key changes: - app.js: cache last serverinfo in window._lastServerInfo and dispatch serverinfo-update event so pages can pick up data immediately - serverInfo.js: replaced setInterval-based polling with event listener plus immediate _lastServerInfo cache check, eliminating the initial blank page state and duplicate RCON requests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -46,6 +46,10 @@
|
||||
document.getElementById('header-players').innerHTML = '<i class="bi bi-people-fill"></i> ' + formatNumber(data.Players) + '/' + formatNumber(data.MaxPlayers);
|
||||
document.getElementById('header-fps').innerHTML = '<i class="bi bi-speedometer2"></i> ' + formatNumber(data.Framerate) + 'fps';
|
||||
document.getElementById('header-entities').innerHTML = '<i class="bi bi-boxes"></i> ' + formatNumber(data.EntityCount);
|
||||
|
||||
// Cache for late-arriving pages (e.g. serverInfo) and broadcast to listeners
|
||||
window._lastServerInfo = data;
|
||||
document.dispatchEvent(new CustomEvent('serverinfo-update', { detail: data }));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user