Skip to content

Commit 84bab8a

Browse files
committed
chore: handle edge cases
1 parent 420fc66 commit 84bab8a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/backend/src/helpers/compute-for-each-parameters.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function computeForEachParameters({
9191

9292
let dataValue: IJSONValue = keyPath
9393
let forEachKeyPath = get(data, keyPath)
94-
const currentStepIndex = stepPositions[executionStep?.stepId]
94+
const currentStepIndex = stepPositions?.[executionStep?.stepId] || -1
9595

9696
// handling of checkboxes which is just a flat array
9797
forEachKeyPath = String(forEachKeyPath).replace(
@@ -103,14 +103,14 @@ export function computeForEachParameters({
103103
executionStep.appKey === TOOLBOX_APP_KEY &&
104104
executionStep.key === TOOLBOX_ACTIONS.FOR_EACH
105105
) {
106-
dataValue = get(data, forEachKeyPath as string)
106+
dataValue = get(data, forEachKeyPath as string) || ''
107107
} else if (currentStepIndex > forEachStepIndex) {
108108
// find the specific execution step for the same iteration
109109
const iterationExecutionStep = executionSteps.find(
110110
(es) =>
111111
es.stepId === stepId && es.metadata.iteration === metadata?.iteration,
112112
)
113-
dataValue = get(iterationExecutionStep?.dataOut, keyPath)
113+
dataValue = get(iterationExecutionStep?.dataOut, keyPath) || ''
114114
}
115115
return dataValue
116116
}

0 commit comments

Comments
 (0)