From eecb943b798dd8bc302fced3eae68218798efeab Mon Sep 17 00:00:00 2001 From: Tuan Cao Date: Mon, 18 Apr 2022 17:17:13 +0700 Subject: [PATCH] ... --- components/FolderTree.js | 1 + components/Graph.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/FolderTree.js b/components/FolderTree.js index 0c0c10e..9fd2a6a 100644 --- a/components/FolderTree.js +++ b/components/FolderTree.js @@ -29,6 +29,7 @@ export default function FolderTree(props) { // console.log(currentNode) if (currentNode != null && currentNode.routePath != null) { router.push(currentNode.routePath) + router.reload() } }} sx={{ flexGrow: 1, maxWidth: 400, overflowY: 'auto' }} diff --git a/components/Graph.js b/components/Graph.js index 91258c7..e01ce4e 100644 --- a/components/Graph.js +++ b/components/Graph.js @@ -1,7 +1,7 @@ import React, {useState} from 'react'; // import cytoscape from 'cytoscape'; // import cola from 'cytoscape-cola'; - +import {useRouter} from 'next/router' import CytoscapeComponent from "react-cytoscapejs"; @@ -65,7 +65,7 @@ function Graph({graph}) { }); let myCyRef; - + const router = useRouter() return ( <>
@@ -96,8 +96,8 @@ function Graph({graph}) { var node = evt.target; let nodeData = node.data(); if (typeof nodeData.id === 'string') { - const routerPath = '/note/' + node.data().id - router.push(routerPath) + router.path = '/note/' + node.data().id + router.reload() } }); }}