From 7ea16d46770e80189104dfc8e3318a74763f1df6 Mon Sep 17 00:00:00 2001 From: oOHiyoriOo Date: Sat, 13 Jun 2026 18:10:04 +0200 Subject: [PATCH] fix: defer startPolling until all NVD3 charts initialized nv.addGraph uses setTimeout internally, so chart models may not exist yet when the first WebSocket response arrives. Moved startPolling() into the last nv.addGraph callback to guarantee charts are ready before data flows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- js/pages/serverInfo.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/pages/serverInfo.js b/js/pages/serverInfo.js index 70982e0..1ce9ed6 100644 --- a/js/pages/serverInfo.js +++ b/js/pages/serverInfo.js @@ -99,6 +99,10 @@ function ServerInfoPage(params, container) { d3.select('#chart-players').datum([]).call(playersChart); window._playersChart = playersChart; + + // All charts ready — start polling data + if (Rcon.isConnected()) startPolling(); + else { var _c = function () { startPolling(); Rcon.off('connected', _c); }; Rcon.on('connected', _c); } }); // ---- Data polling ---- @@ -183,9 +187,6 @@ function ServerInfoPage(params, container) { pollTimer = setInterval(refresh, 1000); } - if (Rcon.isConnected()) startPolling(); - else { var _c = function () { startPolling(); Rcon.off('connected', _c); }; Rcon.on('connected', _c); } - return function cleanup() { if (pollTimer) clearInterval(pollTimer); window._perfChart = null;