diff --git a/lib/utils.js b/lib/utils.js index f561a26..f88f30a 100644 --- a/lib/utils.js +++ b/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, diff --git a/pages/note/[id].js b/pages/note/[id].js index 510e61b..73c4330 100644 --- a/pages/note/[id].js +++ b/pages/note/[id].js @@ -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 ( @@ -40,7 +29,7 @@ export default function Home({note, backLinks, fileNames, tree, flattenNodes, gr - +