mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-05-14 16:55:34 +00:00
Fix: revert WS handler to sync — async resolve was blocking rendering
Per-observer resolve in the WS handler made it async, which broke the debounce callback (unhandled promise + race conditions). Live packets now render immediately with global cache. Per-observer resolution happens on initial load and packet detail only.
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@
|
||||
<script src="hop-display.js?v=1774221932"></script>
|
||||
<script src="app.js?v=1774126708"></script>
|
||||
<script src="home.js?v=1774042199"></script>
|
||||
<script src="packets.js?v=1774224661"></script>
|
||||
<script src="packets.js?v=1774225004"></script>
|
||||
<script src="map.js?v=1774220756" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="channels.js?v=1774331200" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="nodes.js?v=1774221131" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
|
||||
+1
-25
@@ -293,31 +293,7 @@
|
||||
for (const p of filtered) {
|
||||
try { JSON.parse(p.path_json || '[]').forEach(h => { if (!(h in hopNameCache)) newHops.add(h); }); } catch {}
|
||||
}
|
||||
(newHops.size ? resolveHops([...newHops]) : Promise.resolve()).then(async () => {
|
||||
// Per-observer resolve for ambiguous hops in this batch
|
||||
const batchByObs = {};
|
||||
for (const p of filtered) {
|
||||
if (!p.observer_id) continue;
|
||||
try {
|
||||
const path = JSON.parse(p.path_json || '[]');
|
||||
const ambig = path.filter(h => hopNameCache[h]?.ambiguous && !hopNameCache[h + ':' + p.observer_id]);
|
||||
if (ambig.length) {
|
||||
if (!batchByObs[p.observer_id]) batchByObs[p.observer_id] = new Set();
|
||||
ambig.forEach(h => batchByObs[p.observer_id].add(h));
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
await Promise.all(Object.entries(batchByObs).map(async ([obsId, hopsSet]) => {
|
||||
try {
|
||||
const result = await api(`/resolve-hops?hops=${[...hopsSet].join(',')}&observer=${obsId}`);
|
||||
if (result?.resolved) {
|
||||
for (const [k, v] of Object.entries(result.resolved)) {
|
||||
hopNameCache[k + ':' + obsId] = v;
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}));
|
||||
|
||||
(newHops.size ? resolveHops([...newHops]) : Promise.resolve()).then(() => {
|
||||
if (groupByHash) {
|
||||
// Update existing groups or create new ones
|
||||
for (const p of filtered) {
|
||||
|
||||
Reference in New Issue
Block a user