Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复边被重复删除导致edge is not exist报错的问题 #283

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,17 @@ export class GraphRenderCommand implements ICommand {
await commandService.executeCommand(XFlowNodeCommands.DEL_NODE.id, { nodeConfig: nodeData })
}
}
for (const removeEdge of removeEdges) {
const edgeData = removeEdge?.getData()
await commandService.executeCommand(XFlowEdgeCommands.DEL_EDGE.id, { edgeConfig: edgeData })
/** 节点删除会同步删除其关联的边, 获取当前边的集合, 判断该边是否已经删除 */
const allEdges = x6Graph.getEdges()
if (allEdges.length > 0) {
for (const removeEdge of removeEdges) {
if (allEdges.includes(removeEdge)) {
const edgeData = removeEdge?.getData()
await commandService.executeCommand(XFlowEdgeCommands.DEL_EDGE.id, {
edgeConfig: edgeData,
})
}
}
}

if (x6Graph?.isFrozen()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export namespace NsDelNode {
@injectable({
token: { token: ICommandHandler, named: NsDelNode.command.id },
})
/** 创建节点命令 */
/** 删除节点命令 */
export class DelNodeCommand implements ICommand {
/** api */
@inject(ICommandContextProvider) contextProvider: ICommand['contextProvider']
Expand Down