Sort initial chat entries by last-heard (#20)

This commit is contained in:
l5y
2025-09-13 18:02:47 +02:00
committed by GitHub
parent 1118804873
commit 52d3430edb
+6 -1
View File
@@ -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();