From 55db2bef272e9b138bbf1716597f0c87d08440cb Mon Sep 17 00:00:00 2001
From: Kpa-clawbot <259247574+Kpa-clawbot@users.noreply.github.com>
Date: Fri, 27 Mar 2026 08:07:45 -0700
Subject: [PATCH] fix: auto-update Nodes tab when ADVERT packets arrive via
WebSocket
Fixes #131
The Nodes tab required a full page reload to see newly advertised nodes
because loadNodes() cached the node list in _allNodes and never
re-fetched it on WebSocket updates.
Changes:
- WS handler now filters for ADVERT packets only (payload_type 4 or
payloadTypeName ADVERT), instead of triggering on every packet type
- Uses 5-second debounce to avoid excessive API calls during bursts
- Resets _allNodes cache and invalidates API cache before re-fetching
- loadNodes(refreshOnly) parameter: when true, updates table rows and
counts without rebuilding the entire panel (preserves scroll position,
selected node, tabs, filters, and event listeners)
- Extracted isAdvertMessage() as testable helper with window._nodesIsAdvertMessage hook
- 13 new tests (76 total frontend helpers)
- Cache busters bumped
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
public/index.html | 52 +++++++--------
public/nodes.js | 27 +++++++-
test-frontend-helpers.js | 134 +++++++++++++++++++++++++++++++++++++++
3 files changed, 184 insertions(+), 29 deletions(-)
diff --git a/public/index.html b/public/index.html
index fbe18833..4f587de6 100644
--- a/public/index.html
+++ b/public/index.html
@@ -22,9 +22,9 @@
-
-
-
+
+
+
@@ -81,28 +81,28 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+