fix: recent packets always sorted newest-first

Server was returning oldest-first despite .reverse() — sort client-side
to guarantee descending time order on both detail page and side pane.
This commit is contained in:
you
2026-03-23 16:58:09 +00:00
parent d97f35534f
commit 790e96331d
+2 -2
View File
@@ -95,7 +95,7 @@
api('/nodes/' + encodeURIComponent(pubkey) + '/health', { ttl: CLIENT_TTL.nodeDetail }).catch(() => null)
]);
const n = nodeData.node;
const adverts = nodeData.recentAdverts || [];
const adverts = (nodeData.recentAdverts || []).sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
const title = document.querySelector('.node-full-title');
if (title) title.textContent = n.name || pubkey.slice(0, 12);
@@ -499,7 +499,7 @@
function renderDetail(panel, data) {
const n = data.node;
const adverts = data.recentAdverts || [];
const adverts = (data.recentAdverts || []).sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
const h = data.healthData || {};
const stats = h.stats || {};
const observers = h.observers || [];