diff --git a/frontend/src/routes/visual-editor/VisualEditor.tsx b/frontend/src/routes/visual-editor/VisualEditor.tsx index f732821..3392048 100644 --- a/frontend/src/routes/visual-editor/VisualEditor.tsx +++ b/frontend/src/routes/visual-editor/VisualEditor.tsx @@ -315,10 +315,10 @@ export default function VisualEditor(props: VisualEditorProps) { instance.setEdges((es) => { const newEdges = [...es]; const changedEdge = newEdges.find((e) => e.id === id); - if (changedEdge?.data !== undefined) { + if (changedEdge !== undefined) { changedEdge.data = { ...changedEdge.data, ...newData }; } else { - console.warn("Did not find changed edge data"); + console.warn("Did not find changed edge data for id: " + id); } return newEdges; }); @@ -357,11 +357,6 @@ export default function VisualEditor(props: VisualEditorProps) { strokeWidth: 2, stroke: "#969696", }, - data: { - color: "#969696", - minCount: null, - maxCount: null, - }, }} proOptions={{ hideAttribution: true }} onCopyCapture={(ev) => { diff --git a/frontend/src/routes/visual-editor/helper/EventTypeLink.tsx b/frontend/src/routes/visual-editor/helper/EventTypeLink.tsx index f3ed32a..64f421d 100644 --- a/frontend/src/routes/visual-editor/helper/EventTypeLink.tsx +++ b/frontend/src/routes/visual-editor/helper/EventTypeLink.tsx @@ -9,7 +9,7 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; -import { useContext, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { LuHash } from "react-icons/lu"; import { Input } from "@/components/ui/input"; @@ -41,7 +41,15 @@ export default function EventTypeLink(props: EdgeProps) { }); const { onEdgeDataChange } = useContext(VisualEditorContext); - + useEffect(() => { + if (data === undefined) { + onEdgeDataChange(id, { + color: "#969696", + maxCount: null, + minCount: null, + }); + } + }, [data]); return ( <>