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 <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-14 05:28:29 +00:00
1 parent 3536c54d1b
commit aeec529350
2 files changed
+15 -3

No files matched your search

+12 -3
View File
@@ -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();
}
+3
View File
@@ -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 -