Skip to content

Commit

Permalink
fix: don't render edges for nodes we don't have
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed Dec 11, 2024
1 parent 701df06 commit 5fef3dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Configs/Graph/ConfigRelationshipGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ export function ConfigRelationshipGraph({ configs }: ConfigGraphProps) {
const direction = useConfigGraphDirectionToggleValue();

const edges: Edge<ConfigGraphNodes>[] = useMemo(() => {
const nodeIDs = new Set(configsForGraph.map((c) => c.nodeId));

const e: Edge<ConfigGraphNodes>[] = [];
configsForGraph.forEach((config) => {
config.related_ids?.forEach((related_id) => {
if (!nodeIDs.has(related_id)) {
// we should only be rendering edges for configs that were returned.
return;
}

e.push({
id: `${config.nodeId}-related-to-${related_id}`,
source: config.nodeId,
Expand Down

0 comments on commit 5fef3dd

Please sign in to comment.