diff --git a/packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx b/packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx index bbded3312..843ab71e7 100644 --- a/packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx +++ b/packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx @@ -106,15 +106,21 @@ const CustomNode: FunctionComponent = observer( } }, end(dropResult, monitor) { - const graph = controller.getGraph(); - // Show all edges after dropping - graph.getEdges().forEach((edge) => edge.setVisible(true)); - if (monitor.didDrop() && dropResult) { const draggedNodePath = element.getData().vizNode.data.path; dropResult.getData()?.vizNode?.moveNodeTo(draggedNodePath); + // Set an empty model to clear the graph + controller.fromModel({ + nodes: [], + edges: [], + }); entitiesContext.updateEntitiesFromCamelResource(); } else { + // Show all edges after dropping + controller + .getGraph() + .getEdges() + .forEach((edge) => edge.setVisible(true)); controller.getGraph().layout(); } },