From ec72deb775c5285bdca44bf9e41311fb92020cb5 Mon Sep 17 00:00:00 2001 From: you Date: Wed, 18 Mar 2026 21:49:45 +0000 Subject: [PATCH] Preserve expanded group rows across live refresh Re-fetch children for expanded groups after loadPackets rebuilds the packet array, so expanded rows don't collapse on WS refresh. --- public/packets.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/packets.js b/public/packets.js index 6f1dd73..37feab2 100644 --- a/public/packets.js +++ b/public/packets.js @@ -148,6 +148,22 @@ } if (allHops.size) await resolveHops([...allHops]); + // Restore expanded group children + if (groupByHash && expandedHashes.size > 0) { + for (const hash of expandedHashes) { + const group = packets.find(p => p.hash === hash); + if (group) { + try { + const childData = await api(`/packets?hash=${hash}&limit=20`); + group._children = childData.packets || []; + } catch {} + } else { + // Group no longer in results — remove from expanded + expandedHashes.delete(hash); + } + } + } + renderLeft(); } catch (e) { console.error('Failed to load packets:', e);