From 3e0f88f0a815f1a53804b23be2b10e708be79077 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:02:06 -0700 Subject: [PATCH] fix: UI crashes when running pipeline(s) with many stages. (backport #9960) (#9974) Co-authored-by: armory-abedonik <106548537+armory-abedonik@users.noreply.github.com> --- .../src/pipeline/config/graph/PipelineGraph.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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); }