feat: implement isConditionBranchEdge function and update deleteConditionBranch logic; add tests for condition branch line matching
This commit is contained in:
@@ -297,10 +297,18 @@ export function deleteConditionBranch(
|
||||
})
|
||||
return {
|
||||
...nextDefinition,
|
||||
edges: nextDefinition.edges.filter((edge) => !(edge.sourceNodeID === nodeId && edge.sourcePortID === branchId)),
|
||||
edges: nextDefinition.edges.filter((edge) => !isConditionBranchEdge(edge, nodeId, branchId)),
|
||||
}
|
||||
}
|
||||
|
||||
export function isConditionBranchEdge(
|
||||
edge: { sourceNodeID?: unknown; sourcePortID?: unknown },
|
||||
nodeId: string,
|
||||
branchId: string
|
||||
): boolean {
|
||||
return String(edge.sourceNodeID ?? "") === nodeId && String(edge.sourcePortID ?? "") === branchId
|
||||
}
|
||||
|
||||
export function normalizeConditionPortsForFlowgram(
|
||||
definition: AIWorkflowDefinition
|
||||
): AIWorkflowDefinition {
|
||||
|
||||
Reference in New Issue
Block a user