Skip to content

Commit

Permalink
fix: UI crashes when running pipeline(s) with many stages. (backport #…
Browse files Browse the repository at this point in the history
…9960) (#9974)

Co-authored-by: armory-abedonik <[email protected]>
  • Loading branch information
mergify[bot] and armory-abedonik authored Apr 10, 2023
1 parent 394ba17 commit 3e0f88f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/core/src/pipeline/config/graph/PipelineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,22 @@ export class PipelineGraph extends React.Component<IPipelineGraphProps, IPipelin
if (!node.children.length) {
return node.phase;
}
const checkedNodeIds = new Set<string | number>();
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<string | number>) {
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);
}
Expand Down

0 comments on commit 3e0f88f

Please sign in to comment.