Bug: Analysis Map Shows Fewer Neighbor Links When Multiple Sources Selected
Summary
When selecting multiple sources (e.g. LoRa + MQTT) on the Analysis Map, fewer neighbor info links are displayed than when viewing either source individually. The combined view should show the union of all links, but it instead silently drops cross-source edges.
Root Cause
File: src/components/MapAnalysis/layers/NeighborLinksLayer.tsx (~lines 80–100)
The layer builds a position lookup map keyed by "${sourceId}:${nodeNum}". When rendering edges, it resolves both endpoint positions using only the edge's own sourceId:
const aKey = `${e.sourceId}:${Number(e.nodeNum)}`;
const bKey = `${e.sourceId}:${Number(e.neighborNum)}`;
const a = positionByKey.get(aKey);
const b = positionByKey.get(bKey);
if (!a || !b) continue; // silently drops the edge
A neighbor edge carries a single sourceId — the source on which the reporting node's packet arrived. But the neighbor node's position may only be recorded under a different source.
Example:
- Edge reported on source B → looks up
B:neighborNodeNum
- Neighbor node only has a known position under
A:neighborNodeNum
- Lookup returns
undefined → edge is silently skipped
Result: only edges where both endpoints have a position on the same source as the reporting node survive — effectively an intersection, not a union.
Scope
The API is correct: src/db/repositories/analysis.ts getNeighbors() uses inArray(neighbors.sourceId, args.sourceIds) and returns the full union across all selected sources. The bug is entirely in frontend rendering.
Proposed Fix
In NeighborLinksLayer.tsx, replace the strict source-scoped lookup with a fallback: first try ${e.sourceId}:${nodeNum}, then fall back to any key matching nodeNum across all sources present in the position map. Cross-source edges will then render correctly as long as both endpoints have a known position on any selected source.
Reproduction
- Open Analysis Map with at least two sources configured (e.g. LoRa + MQTT)
- Select only Source A — note the neighbor links visible
- Select only Source B — note the neighbor links visible
- Select both sources — observe fewer links than either individual view
Authored by NodeZero 0️⃣
Bug: Analysis Map Shows Fewer Neighbor Links When Multiple Sources Selected
Summary
When selecting multiple sources (e.g. LoRa + MQTT) on the Analysis Map, fewer neighbor info links are displayed than when viewing either source individually. The combined view should show the union of all links, but it instead silently drops cross-source edges.
Root Cause
File:
src/components/MapAnalysis/layers/NeighborLinksLayer.tsx(~lines 80–100)The layer builds a position lookup map keyed by
"${sourceId}:${nodeNum}". When rendering edges, it resolves both endpoint positions using only the edge's ownsourceId:A neighbor edge carries a single
sourceId— the source on which the reporting node's packet arrived. But the neighbor node's position may only be recorded under a different source.Example:
B:neighborNodeNumA:neighborNodeNumundefined→ edge is silently skippedResult: only edges where both endpoints have a position on the same source as the reporting node survive — effectively an intersection, not a union.
Scope
The API is correct:
src/db/repositories/analysis.tsgetNeighbors()usesinArray(neighbors.sourceId, args.sourceIds)and returns the full union across all selected sources. The bug is entirely in frontend rendering.Proposed Fix
In
NeighborLinksLayer.tsx, replace the strict source-scoped lookup with a fallback: first try${e.sourceId}:${nodeNum}, then fall back to any key matchingnodeNumacross all sources present in the position map. Cross-source edges will then render correctly as long as both endpoints have a known position on any selected source.Reproduction
Authored by NodeZero 0️⃣