Skip to content

Commit

Permalink
fix: remove connected edges when remove node
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector committed Jul 21, 2024
1 parent 80d8579 commit 5073ace
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/xflow",
"version": "2.1.6",
"version": "2.1.10",
"description": "",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/components/State.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,12 @@ const XFlowState: FC<
});

// Remove cells for internal operations
useGraphEvent('cell:removed', ({ cell, options }) => {
if (!options[INNER_CALL]) {
if (cell.isNode()) {
removeNodes([cell.id], { silent: true });
} else if (cell.isEdge()) {
removeEdges([cell.id], { silent: true });
}
useGraphEvent('cell:removed', ({ cell }) => {
// no need to check INNER_CALL here
if (cell.isNode()) {
removeNodes([cell.id], { silent: true });
} else if (cell.isEdge()) {
removeEdges([cell.id], { silent: true });
}
});

Expand Down

0 comments on commit 5073ace

Please sign in to comment.