Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: workflow delete edge (#3541)

zxhlyh2e27425e939d
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts
index ea9af3e9aa3..e092f1cbd3d 100644
--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts
+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts
@@ -820,8 +820,14 @@ export const useNodesInteractions = () => {
const {
getNodes,
+ edges,
} = store.getState()
+ const currentEdgeIndex = edges.findIndex(edge => edge.selected)
+
+ if (currentEdgeIndex > -1)
+ return
+
const nodes = getNodes()
const nodesToDelete = nodes.filter(node => node.data.selected)
diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx
index fdd6d73fad8..ca501e29983 100644
--- a/web/app/components/workflow/index.tsx
+++ b/web/app/components/workflow/index.tsx
@@ -137,8 +137,8 @@ const Workflow: FC<WorkflowProps> = memo(({
},
})
- useKeyPress(['delete'], handleEdgeDelete)
useKeyPress(['delete', 'backspace'], handleNodeDeleteSelected)
+ useKeyPress(['delete', 'backspace'], handleEdgeDelete)
useKeyPress(['ctrl.c', 'meta.c'], handleNodeCopySelected)
useKeyPress(['ctrl.x', 'meta.x'], handleNodeCut)
useKeyPress(['ctrl.v', 'meta.v'], handleNodePaste)