From 44648eef92265f0a80c0c72ca1729d6eca6c4178 Mon Sep 17 00:00:00 2001 From: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:46:31 -0500 Subject: [PATCH] fix(modes): don't attempt to retrieve a stage index if HPs are an array (#4542) --- platform/app/src/routes/Mode/Mode.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/app/src/routes/Mode/Mode.tsx b/platform/app/src/routes/Mode/Mode.tsx index bf6cc9052..27351e672 100644 --- a/platform/app/src/routes/Mode/Mode.tsx +++ b/platform/app/src/routes/Mode/Mode.tsx @@ -218,11 +218,11 @@ export default function ModeRoute({ : hangingProtocol; // Determine the index of the stageId if the hangingProtocolIdToUse is defined - const stageIndex = hangingProtocolIdToUse - ? hangingProtocolService.getStageIndex(hangingProtocolIdToUse, { + const stageIndex = Array.isArray(hangingProtocolIdToUse) + ? -1 + : hangingProtocolService.getStageIndex(hangingProtocolIdToUse, { stageId: runTimeStageId || undefined, - }) - : -1; + }); // Ensure that the stage index is never negative // If stageIndex is negative (e.g., if stage wasn't found), use 0 as the default const stageIndexToUse = Math.max(0, stageIndex);