From f85c19dcfaf0c9d9b74606feec1a9c3802989524 Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Wed, 21 Aug 2024 09:00:42 +0100 Subject: [PATCH] eslint errors --- src/PolicyTopology.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/PolicyTopology.js b/src/PolicyTopology.js index 215ad81..871a1d5 100644 --- a/src/PolicyTopology.js +++ b/src/PolicyTopology.js @@ -14,6 +14,24 @@ const PolicyTopology = ({ dotString }) => { const [dropdownItems, setDropdownItems] = useState([]); const [selectedLabel, setSelectedLabel] = useState(''); + useEffect(() => { + const g = dot.read(dotString); + graphRef.current = g; + setFilteredDot(dotString); + + const items = [ + handleNodeSelection(null)}> + - + , + ...g.nodes().map(node => ( + handleNodeSelection(node)}> + {g.node(node).label} + + )), + ]; + setDropdownItems(items); + }, [dotString]); + const handleNodeSelection = useCallback((nodeId) => { const graph = graphRef.current; if (!graph) {