This commit is contained in:
Tuan Cao 2022-04-18 17:17:13 +07:00
parent e331a9c7c9
commit eecb943b79
2 changed files with 5 additions and 4 deletions

View File

@ -29,6 +29,7 @@ export default function FolderTree(props) {
// console.log(currentNode) // console.log(currentNode)
if (currentNode != null && currentNode.routePath != null) { if (currentNode != null && currentNode.routePath != null) {
router.push(currentNode.routePath) router.push(currentNode.routePath)
router.reload()
} }
}} }}
sx={{ flexGrow: 1, maxWidth: 400, overflowY: 'auto' }} sx={{ flexGrow: 1, maxWidth: 400, overflowY: 'auto' }}

View File

@ -1,7 +1,7 @@
import React, {useState} from 'react'; import React, {useState} from 'react';
// import cytoscape from 'cytoscape'; // import cytoscape from 'cytoscape';
// import cola from 'cytoscape-cola'; // import cola from 'cytoscape-cola';
import {useRouter} from 'next/router'
import CytoscapeComponent from "react-cytoscapejs"; import CytoscapeComponent from "react-cytoscapejs";
@ -65,7 +65,7 @@ function Graph({graph}) {
}); });
let myCyRef; let myCyRef;
const router = useRouter()
return ( return (
<> <>
<div> <div>
@ -96,8 +96,8 @@ function Graph({graph}) {
var node = evt.target; var node = evt.target;
let nodeData = node.data(); let nodeData = node.data();
if (typeof nodeData.id === 'string') { if (typeof nodeData.id === 'string') {
const routerPath = '/note/' + node.data().id router.path = '/note/' + node.data().id
router.push(routerPath) router.reload()
} }
}); });
}} }}