From d5a39032eba1d04d643c88644e1e2632c1fa8790 Mon Sep 17 00:00:00 2001 From: Ricardo van der Heijden <20791917+ricardovdheijden@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:32:28 +0200 Subject: [PATCH] 336 - Extracts reusable local variable "previousStep" --- .../WFOWorkflowSteps/WFOStepList/WFOStepList.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/orchestrator-ui-components/src/components/WFOWorkflowSteps/WFOStepList/WFOStepList.tsx b/packages/orchestrator-ui-components/src/components/WFOWorkflowSteps/WFOStepList/WFOStepList.tsx index 331891708..aeb3c5394 100644 --- a/packages/orchestrator-ui-components/src/components/WFOWorkflowSteps/WFOStepList/WFOStepList.tsx +++ b/packages/orchestrator-ui-components/src/components/WFOWorkflowSteps/WFOStepList/WFOStepList.tsx @@ -72,17 +72,16 @@ export const WFOStepList = React.forwardRef( if (stepListItem.step.status === StepStatus.SUCCESS) { // Prepare a delta with the last successful stepListItem let previousIndex = index - 1; + const previousStep = + stepListItems[previousIndex].step; while ( previousIndex > 0 && - (stepListItems[previousIndex].step.status === - StepStatus.FAILED || - stepListItems[previousIndex].step.status === - StepStatus.WAITING) + (previousStep.status === StepStatus.FAILED || + previousStep.status === StepStatus.WAITING) ) { previousIndex--; } - previousState = - stepListItems[previousIndex].step.state; + previousState = previousStep.state; delta = stateDelta( previousState, stepListItem.step.state,