Filter out non-existent target edge
This commit is contained in:
parent
0efef3cebf
commit
e331a9c7c9
10
lib/utils.js
10
lib/utils.js
@ -168,16 +168,12 @@ export function getLocalGraphData(currentNodeId) {
|
||||
}
|
||||
|
||||
const localNodes = newNodes.filter(aNode => localNodeIds.includes(aNode.data.id))
|
||||
var localEdges = newEdges.filter(edge => localNodeIds.includes(edge.data.source)).filter(edge => localNodeIds.includes(edge.data.target))
|
||||
let localEdges = newEdges.filter(edge => localNodeIds.includes(edge.data.source)).filter(edge => localNodeIds.includes(edge.data.target));
|
||||
|
||||
localEdges.forEach(edge => {
|
||||
if (edge.data.target === '/') {
|
||||
console.log(edge.data.target)
|
||||
}
|
||||
|
||||
})
|
||||
// Filter self-reference edges
|
||||
localEdges = localEdges.filter(edge => edge.data.source !== edge.data.target)
|
||||
|
||||
// TODO: Find out why target ==='/' in some case
|
||||
localEdges = localEdges.filter(edge => edge.data.target !== '/')
|
||||
return {
|
||||
nodes: localNodes,
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
import FolderTree from "../../components/FolderTree";
|
||||
import {getFlattenArray} from "../../lib/utils";
|
||||
import MDContent from "../../components/MDContent";
|
||||
// import
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
const DynamicGraph = dynamic(
|
||||
@ -20,16 +19,6 @@ const DynamicGraph = dynamic(
|
||||
|
||||
export default function Home({note, backLinks, fileNames, tree, flattenNodes, graphData}) {
|
||||
|
||||
// const router = useRouter();
|
||||
//
|
||||
// useEffect(() => {
|
||||
// if (isMenuOpen) {
|
||||
// setMenuOpen(!isMenuOpen);
|
||||
// }
|
||||
// }, [router.asPath]);
|
||||
//
|
||||
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Head>
|
||||
@ -40,7 +29,7 @@ export default function Home({note, backLinks, fileNames, tree, flattenNodes, gr
|
||||
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
|
||||
</nav>
|
||||
<MDContent content={note.data} fileNames={fileNames} handleOpenNewContent={null} backLinks={backLinks}/>
|
||||
<DynamicGraph graph={graphData || null }/>
|
||||
<DynamicGraph graph={graphData}/>
|
||||
</div>
|
||||
|
||||
</Layout>
|
||||
|
Loading…
Reference in New Issue
Block a user