From 65ac4f69af39535c4fc56e9766b24900d10f9641 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Tue, 23 Apr 2024 14:45:57 +0800 Subject: [PATCH] fix: workflow shortcuts (#3701) --- web/app/components/workflow/hooks/use-nodes-interactions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index e092f1cbd3..242e2d35aa 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -406,6 +406,8 @@ export const useNodesInteractions = () => { const nodes = getNodes() const currentNodeIndex = nodes.findIndex(node => node.id === nodeId) + if (nodes[currentNodeIndex].data.type === BlockEnum.Start) + return const connectedEdges = getConnectedEdges([{ id: nodeId } as Node], edges) const nodesConnectedSourceOrTargetHandleIdsMap = getNodesConnectedSourceOrTargetHandleIdsMap(connectedEdges.map(edge => ({ type: 'remove', edge })), nodes) const newNodes = produce(nodes, (draft: Node[]) => { @@ -732,7 +734,7 @@ export const useNodesInteractions = () => { } = store.getState() const nodes = getNodes() - const nodesToCopy = nodes.filter(node => node.data.selected) + const nodesToCopy = nodes.filter(node => node.data.selected && node.data.type !== BlockEnum.Start) setClipboardElements(nodesToCopy)