From 70b5c59233dbdae0b780746c25f7cef156f77fc9 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Thu, 29 Jul 2021 17:06:04 +0300 Subject: Minor refactoring --- pages/index.tsx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'pages') diff --git a/pages/index.tsx b/pages/index.tsx index 06f24ea..51b21fc 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -123,18 +123,13 @@ export function GraphPage() { const message = JSON.parse(event.data) switch (message.type) { case 'graphdata': - updateGraphData(message.data) - break + return updateGraphData(message.data) case 'theme': - console.log('Received theme data') - setEmacsTheme(message.data) - break + return setEmacsTheme(message.data) case 'command': - console.log('command') switch (message.data.commandName) { case 'follow': - setEmacsNodeId(message.data.id) - break + return setEmacsNodeId(message.data.id) case 'zoom': { const links = linksByNodeIdRef.current[message.data.id!] ?? [] const nodes = Object.fromEntries( @@ -146,20 +141,12 @@ export function GraphPage() { /* zoomToFit(500, 200, (node: OrgRoamNode)=>nodes[node.id!]) */ } default: - console.log('oopsie whoopsie') + return console.error('unknown message type', message.type) } } }) - // fetchGraphData() }, []) - useEffect(() => { - if (!emacsNodeId) { - return - } - //fetchGraphData() - }, [emacsNodeId]) - const [threeDim, setThreeDim] = useState(false) if (!graphData) { -- cgit v1.2.3