From 790e96331d7e7eea2942a55f8fd1e4aea8bae553 Mon Sep 17 00:00:00 2001 From: you Date: Mon, 23 Mar 2026 16:58:09 +0000 Subject: [PATCH] fix: recent packets always sorted newest-first MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Server was returning oldest-first despite .reverse() — sort client-side to guarantee descending time order on both detail page and side pane. --- public/nodes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/nodes.js b/public/nodes.js index c80727f6..512d8629 100644 --- a/public/nodes.js +++ b/public/nodes.js @@ -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 || [];