summaryrefslogtreecommitdiff
path: root/pages/index.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-08-01 00:03:52 +0200
committerThomas F. K. Jorna <[email protected]>2021-08-01 00:03:52 +0200
commit565f99190c29c02ab1dcd5f72ded466ee96a3837 (patch)
tree20e0d031360c9f593696c91814af41a0e6ef3d56 /pages/index.tsx
parent32017c8f5e0afd4fcdc6fcc877a8d537d41fdf0e (diff)
fixed missing links issue
Diffstat (limited to 'pages/index.tsx')
-rw-r--r--pages/index.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index ccdb07d..7b84222 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -407,9 +407,15 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
return links.some((link) => !['parent', 'cite', 'ref'].includes(link.type))
})
+ const filteredNodeIds = filteredNodes.map((node) => node.id as string)
const filteredLinks = graphData.links.filter((linkArg) => {
const link = linkArg as OrgRoamLink
- return link.type !== 'cite' && (filter.parents || link.type !== 'parent')
+ return (
+ link.type !== 'cite' &&
+ (filter.parents || link.type !== 'parent') &&
+ filteredNodeIds.includes(link.source as string) &&
+ filteredNodeIds.includes(link.target)
+ )
})
const scopedNodes = filteredNodes.filter((node) => {
@@ -429,7 +435,6 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
// but if we supply the original data on each render, the graph will re-render sporadically
const sourceId = typeof link.source === 'object' ? link.source.id! : (link.source as string)
const targetId = typeof link.target === 'object' ? link.target.id! : (link.target as string)
-
return (
scopedNodeIds.includes(sourceId as string) && scopedNodeIds.includes(targetId as string)
)