From 52d3430edb1777020001d0ff42c6f99404b2dc05 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Sat, 13 Sep 2025 18:02:47 +0200 Subject: [PATCH] Sort initial chat entries by last-heard (#20) --- web/public/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/public/index.html b/web/public/index.html index 7dadba5..62a4db1 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -240,12 +240,17 @@ try { statusEl.textContent = 'refreshing…'; const nodes = await fetchNodes(); + const newNodes = []; for (const n of nodes) { if (n.node_id && !seenNodeIds.has(n.node_id)) { - addChatEntry(n); + newNodes.push(n); seenNodeIds.add(n.node_id); } } + newNodes.sort((a, b) => (a.last_heard ?? 0) - (b.last_heard ?? 0)); + for (const n of newNodes) { + addChatEntry(n); + } allNodes = nodes; applyFilter(); statusEl.textContent = 'updated ' + new Date().toLocaleTimeString();