Browse Source

Apply suggested change from code comment

master
liminal 8 months ago
parent
commit
1f3781acf4
No known key found for this signature in database
GPG Key ID: 962BEC8725790894
  1. 9
      src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts

9
src/lib/navigator/EventNetwork/utils/personNetworkBuilder.ts

@ -223,16 +223,15 @@ export function createPersonLinks(
): PersonLink[] { ): PersonLink[] {
debug("Creating person links", { anchorCount: personAnchors.length, nodeCount: nodes.length }); debug("Creating person links", { anchorCount: personAnchors.length, nodeCount: nodes.length });
const links: PersonLink[] = [];
const nodeMap = new Map(nodes.map((n) => [n.id, n])); const nodeMap = new Map(nodes.map((n) => [n.id, n]));
personAnchors.forEach((anchor) => { const links: PersonLink = personAnchors.map((anchor) => {
if (!anchor.connectedNodes || !anchor.pubkey) return; if (!anchor.connectedNodes || !anchor.pubkey) return;
const connection = personMap.get(anchor.pubkey); const connection = personMap.get(anchor.pubkey);
if (!connection) return; if (!connection) return;
anchor.connectedNodes.forEach((nodeId) => { return ...anchor.connectedNodes.map((nodeId) => {
const node = nodeMap.get(nodeId); const node = nodeMap.get(nodeId);
if (node) { if (node) {
// Determine connection type // Determine connection type
@ -243,12 +242,12 @@ export function createPersonLinks(
connectionType = "referenced"; connectionType = "referenced";
} }
links.push({ return {
source: anchor, source: anchor,
target: node, target: node,
isSequential: false, isSequential: false,
connectionType, connectionType,
}); };
} }
}); });
}); });

Loading…
Cancel
Save