diff --git a/packages/core/src/pipeline/config/graph/PipelineGraph.tsx b/packages/core/src/pipeline/config/graph/PipelineGraph.tsx index 407cb31c56c..8fe61e9f6ac 100644 --- a/packages/core/src/pipeline/config/graph/PipelineGraph.tsx +++ b/packages/core/src/pipeline/config/graph/PipelineGraph.tsx @@ -117,15 +117,22 @@ export class PipelineGraph extends React.Component(); const result: number[] = []; - this.collect(node.children, result); + this.collect(node.children, result, checkedNodeIds); return max(result); } - private collect(nodes: IPipelineGraphNode[], result: number[]) { + private collect(nodes: IPipelineGraphNode[], result: number[], checkedNodeIds: Set) { nodes.forEach((node) => { + if (checkedNodeIds.has(node.id)) { + return; + } else { + checkedNodeIds.add(node.id); + } + if (node.children.length) { - this.collect(node.children, result); + this.collect(node.children, result, checkedNodeIds); } else { result.push(node.phase); }