Skip to content

Commit 21e7605

Browse files
authored
don't permit clicking on invalid node types (#24)
Because this just crashes!
1 parent 13dd8cc commit 21e7605

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/_components/GraphCalcDisplay.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ function GraphEvents({
3737
// node events
3838
clickNode: (event) => {
3939
const theNode = graph.getNodeAttributes(event.node);
40-
setItem({ item: theNode.label, nodeType: theNode.nodeType });
40+
console.log("clickNode running", theNode);
41+
if (theNode && ["input", "byproduct"].includes(theNode.nodeType)) {
42+
setItem({ item: theNode.label, nodeType: theNode.nodeType });
43+
}
4144
},
4245
});
4346
}, [registerEvents]);

0 commit comments

Comments
 (0)