diff --git a/src/ui/src/builder/useComponentActions.ts b/src/ui/src/builder/useComponentActions.ts index 5c3807e2e..3ad969607 100644 --- a/src/ui/src/builder/useComponentActions.ts +++ b/src/ui/src/builder/useComponentActions.ts @@ -127,7 +127,7 @@ export function useComponentActions(wf: Core, ssbm: BuilderManager) { type: string, parentId: Component["id"], position?: number, - initProperties?: Partial, + initProperties?: Partial>, ) { const newId = generateNewComponentId(); const definition = wf.getComponentDefinition(type); @@ -729,11 +729,9 @@ export function useComponentActions(wf: Core, ssbm: BuilderManager) { ssbm.openMutationTransaction(transactionId, `Edit out`, true); ssbm.registerPreMutation(component); - component.outs = [ - ...component.outs.filter( - (o) => !(out.outId === o.outId && out.toNodeId === o.toNodeId), - ), - ]; + component.outs = component.outs.filter( + (o) => !(out.outId === o.outId && out.toNodeId === o.toNodeId), + ); ssbm.registerPostMutation(component); ssbm.closeMutationTransaction(transactionId); diff --git a/src/ui/src/components/workflows/WorkflowsWorkflow.vue b/src/ui/src/components/workflows/WorkflowsWorkflow.vue index 215877409..235f52c62 100644 --- a/src/ui/src/components/workflows/WorkflowsWorkflow.vue +++ b/src/ui/src/components/workflows/WorkflowsWorkflow.vue @@ -277,14 +277,12 @@ watch( async (postChildren, preChildren) => { // Remove references when a node is deleted - const preIds = preChildren.map((c) => c.id); - const postIds = postChildren.map((c) => c.id); - const removedIds = preIds.filter((cId) => !postIds.includes(cId)); - removedIds.forEach((removedId) => { - postChildren.forEach((c) => { - if (!c.outs || c.outs.length == 0) return; - c.outs = c.outs.filter((out) => out.toNodeId !== removedId); - }); + const removedIds = new Set(postChildren.map((c) => c.id)); + preChildren.forEach(c => removedIds.delete(c.id)); + + postChildren.forEach((c) => { + c.outs = c.outs?.filter((out) => !removedIds.has(out.toNodeId)); + }); }); // Refresh arrows diff --git a/src/ui/src/components/workflows/base/WorkflowArrow.vue b/src/ui/src/components/workflows/base/WorkflowArrow.vue index 79fe0dcbf..07ac642a4 100644 --- a/src/ui/src/components/workflows/base/WorkflowArrow.vue +++ b/src/ui/src/components/workflows/base/WorkflowArrow.vue @@ -9,7 +9,14 @@ opacity: isSelected ? `0.2` : `0`, }" > - +