perf(frontend): add filter for low interaction graphs & deleted users

This commit is contained in:
2026-02-16 17:09:22 +00:00
parent 4f577abd4f
commit 563212c98e

View File

@@ -19,7 +19,18 @@ function ApiToGraphData(apiData: InteractionGraph) {
}
}
return { nodes, links };
// drop low-value and deleted interactions to reduce clutter
const filteredLinks = links.filter(link =>
link.value >= 2 &&
link.source !== "[deleted]" &&
link.target !== "[deleted]"
);
// also filter out nodes that are no longer connected after link filtering
const connectedNodeIds = new Set(filteredLinks.flatMap(link => [link.source, link.target]));
const filteredNodes = nodes.filter(node => connectedNodeIds.has(node.id));
return { nodes: filteredNodes, links: filteredLinks};
}