fix getAvailableBindings again, aka my personal hell

This commit is contained in:
Peter Clement 2024-09-12 21:02:50 +01:00
parent a831a4bf07
commit 7d6cce20e9
1 changed files with 5 additions and 7 deletions

View File

@ -700,14 +700,12 @@
allSteps[idx]?.stepId === ActionStepID.LOOP && allSteps[idx]?.stepId === ActionStepID.LOOP &&
allSteps.some(x => x.blockToLoop === block.id) allSteps.some(x => x.blockToLoop === block.id)
let schema = cloneDeep(allSteps[idx]?.schema?.outputs?.properties) ?? {} let schema = cloneDeep(allSteps[idx]?.schema?.outputs?.properties) ?? {}
if (wasLoopBlock) { if (allSteps[idx]?.name.includes("Looping")) {
break isLoopBlock = true
loopBlockCount++
} }
let bindingName = let bindingName =
automation.stepNames?.[allSteps[idx - loopBlockCount].id] || automation.stepNames?.[allSteps[idx].id] || allSteps[idx].name
!isLoopBlock
? allSteps[idx]?.name
: allSteps[idx - 1]?.name
if (isLoopBlock) { if (isLoopBlock) {
schema = { schema = {
@ -756,7 +754,7 @@
if (wasLoopBlock) { if (wasLoopBlock) {
loopBlockCount++ loopBlockCount++
continue schema = cloneDeep(allSteps[idx - 1]?.schema?.outputs?.properties)
} }
Object.entries(schema).forEach(([name, value]) => Object.entries(schema).forEach(([name, value]) =>
addBinding(name, value, icon, idx, isLoopBlock, bindingName) addBinding(name, value, icon, idx, isLoopBlock, bindingName)