From e971a5936dbebf26a85446c8f9ed866b71514325 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 5 Oct 2021 14:41:28 +0200 Subject: fix: expanding local graph (#92) --- pages/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pages') diff --git a/pages/index.tsx b/pages/index.tsx index c7713ed..fa40cb7 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -698,7 +698,8 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { } const links = filteredLinksByNodeIdRef.current[node.id as string] ?? [] return links.some((link) => { - return scope.nodeIds.includes(link.source) || scope.nodeIds.includes(link.target) + const [source, target] = normalizeLinkEnds(link) + return scope.nodeIds.includes(source) || scope.nodeIds.includes(target) }) } return neighbs.includes(node.id as string) @@ -736,7 +737,7 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) { const scopedLinks = [...oldScopedLinks, ...newScopedLinks] setScopedGraphData({ nodes: scopedNodes, links: scopedLinks }) - }, [filter, scope, graphData]) + }, [filter, scope, JSON.stringify(graphData), filteredGraphData.links, filteredGraphData.nodes]) centralHighlightedNode.current = hoverNode const highlightedNodes = useMemo(() => { -- cgit v1.2.3