Skip to content

Commit

Permalink
Fix(DND): Fix console errors related to DND
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamG640 committed Jan 8, 2025
1 parent 0bdf733 commit 9761be2
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,21 @@ const CustomNode: FunctionComponent<CustomNodeProps> = 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({

Check warning on line 113 in packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx#L113

Added line #L113 was not covered by tests
nodes: [],
edges: [],
});
entitiesContext.updateEntitiesFromCamelResource();
} else {
// Show all edges after dropping
controller

Check warning on line 120 in packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx#L120

Added line #L120 was not covered by tests
.getGraph()
.getEdges()
.forEach((edge) => edge.setVisible(true));

Check warning on line 123 in packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx#L123

Added line #L123 was not covered by tests
controller.getGraph().layout();
}
},
Expand Down

0 comments on commit 9761be2

Please sign in to comment.