Skip to content

Commit c550e45

Browse files
authored
fix(condition): fix condition block for no outgoing edge (#2306)
* Fix condition block evaluation * Lint
1 parent a881dc1 commit c550e45

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

apps/sim/executor/handlers/condition/condition-handler.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,20 @@ export class ConditionBlockHandler implements BlockHandler {
178178
evalContext
179179
)
180180

181-
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
182-
183-
if (connection && conditionMet) {
184-
return { selectedConnection: connection, selectedCondition: condition }
181+
if (conditionMet) {
182+
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
183+
if (connection) {
184+
return { selectedConnection: connection, selectedCondition: condition }
185+
}
186+
// Condition is true but has no outgoing edge - branch ends gracefully
187+
logger.info(
188+
`Condition "${condition.title}" is true but has no outgoing edge - branch ending`,
189+
{
190+
blockId: block.id,
191+
conditionId: condition.id,
192+
}
193+
)
194+
return { selectedConnection: null, selectedCondition: null }
185195
}
186196
} catch (error: any) {
187197
logger.error(`Failed to evaluate condition "${condition.title}": ${error.message}`)

0 commit comments

Comments
 (0)