mirror of
https://github.com/l5yth/potato-mesh.git
synced 2026-08-11 19:33:09 +02:00
Sort initial chat entries by last-heard (#20)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user