summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-05 14:41:28 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-05 14:41:28 +0200
commite971a5936dbebf26a85446c8f9ed866b71514325 (patch)
tree5485b693547062a073344ecb18fefc2746fd5bc7 /pages
parent73a65738f7829c577ee27be2f3ca5e1cd1867cfd (diff)
fix: expanding local graph (#92)
Diffstat (limited to 'pages')
-rw-r--r--pages/index.tsx5
1 files changed, 3 insertions, 2 deletions
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(() => {