mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -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
|
||||
)
|
||||
|
||||
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
|
||||
|
||||
if (connection && conditionMet) {
|
||||
return { selectedConnection: connection, selectedCondition: condition }
|
||||
if (conditionMet) {
|
||||
const connection = this.findConnectionForCondition(outgoingConnections, condition.id)
|
||||
if (connection) {
|
||||
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) {
|
||||
logger.error(`Failed to evaluate condition "${condition.title}": ${error.message}`)
|
||||
|
||||
Reference in New Issue
Block a user