mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 06:58:07 -05:00
fix(condition): fix condition block for no outgoing edge (#2306)
* Fix condition block evaluation * Lint
This commit is contained in:
committed by
GitHub
parent
a881dc1877
commit
c550e4591c
@@ -178,10 +178,20 @@ export class ConditionBlockHandler implements BlockHandler {
|
|||||||
evalContext
|
evalContext
|
||||||
)
|
)
|
||||||
|
|
||||||
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
|
if (conditionMet) {
|
||||||
|
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
|
||||||
if (connection && conditionMet) {
|
if (connection) {
|
||||||
return { selectedConnection: connection, selectedCondition: condition }
|
return { selectedConnection: connection, selectedCondition: condition }
|
||||||
|
}
|
||||||
|
// Condition is true but has no outgoing edge - branch ends gracefully
|
||||||
|
logger.info(
|
||||||
|
`Condition "${condition.title}" is true but has no outgoing edge - branch ending`,
|
||||||
|
{
|
||||||
|
blockId: block.id,
|
||||||
|
conditionId: condition.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return { selectedConnection: null, selectedCondition: null }
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
logger.error(`Failed to evaluate condition "${condition.title}": ${error.message}`)
|
logger.error(`Failed to evaluate condition "${condition.title}": ${error.message}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user