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) {