From aeec5293500c1328c62055b6b3f818b11349c477 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 14 Feb 2026 05:28:29 +0000 Subject: [PATCH] fix(dashboard): resolve refresh filter reset and relay counter leak Separate filter initialization from connection logic to prevent resetting user preferences on refresh. Add socket cleanup and manual close handling to prevent duplicate connections and incorrect relay counts. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- dashboard/index.html | 15 ++++++++++++--- server.log | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 server.log diff --git a/dashboard/index.html b/dashboard/index.html index 4e4b278..ffb5deb 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -630,7 +630,14 @@ }); ws.addEventListener('close', () => { + // Clean up socket from tracking array + const idx = sockets.indexOf(ws); + if (idx !== -1) { + sockets.splice(idx, 1); + } + if (isTeardown) return; + if (ws.isManualClose) return; connectedCount = Math.max(0, connectedCount - 1); updateConnectionBadge(); @@ -668,6 +675,7 @@ // Close existing connections and reconnect for (const ws of sockets) { try { + ws.isManualClose = true; ws.close(); } catch { // ignore @@ -686,9 +694,6 @@ function init() { if (!isAlive()) return; - cadenceFilter.value = DASHBOARD_CONFIG.defaultCadenceView; - statusFilter.value = DASHBOARD_CONFIG.defaultStatusView; - applyConfigToHelpText(); for (const url of RELAYS) { @@ -702,6 +707,10 @@ RELAYS = DASHBOARD_CONFIG.relays; D_TAG_PREFIX = `${DASHBOARD_CONFIG.namespace}-lock/`; HASHTAG = DASHBOARD_CONFIG.hashtag; + + cadenceFilter.value = DASHBOARD_CONFIG.defaultCadenceView; + statusFilter.value = DASHBOARD_CONFIG.defaultStatusView; + init(); } diff --git a/server.log b/server.log new file mode 100644 index 0000000..a726800 --- /dev/null +++ b/server.log @@ -0,0 +1,3 @@ +127.0.0.1 - - [14/Feb/2026 05:24:39] "GET /dashboard/index.html HTTP/1.1" 200 - +127.0.0.1 - - [14/Feb/2026 05:24:39] "GET /dashboard/styles.css HTTP/1.1" 200 - +127.0.0.1 - - [14/Feb/2026 05:24:40] "GET /torch-config.json HTTP/1.1" 200 -