Skip to content

Commit

Permalink
336 - Extracts reusable local variable "previousStep"
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardovdheijden committed Oct 9, 2023
1 parent 23c4448 commit d5a3903
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d5a3903

Please sign in to comment.