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.
This commit is contained in:
you
2026-03-18 21:49:45 +00:00
parent 0c572b9871
commit ec72deb775
+16
View File
@@ -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);