Skip to content

Commit

Permalink
fix(engine): 🐛 Variable value reset
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 31, 2022
1 parent 5e19f79 commit a9f730b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/bot-engine/src/services/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ const executeSetVariable = (
step: SetVariableStep,
{ typebot: { variables }, updateVariableValue, updateVariables }: LogicContext
): EdgeId | undefined => {
if (!step.options?.variableId || !step.options.expressionToEvaluate)
return step.outgoingEdgeId
const evaluatedExpression = evaluateExpression(variables)(
step.options.expressionToEvaluate
)
if (!step.options?.variableId) return step.outgoingEdgeId
const evaluatedExpression = step.options.expressionToEvaluate
? evaluateExpression(variables)(step.options.expressionToEvaluate)
: undefined
const existingVariable = variables.find(byId(step.options.variableId))
if (!existingVariable) return step.outgoingEdgeId
updateVariableValue(existingVariable.id, evaluatedExpression)
Expand Down

4 comments on commit a9f730b

@vercel
Copy link

@vercel vercel bot commented on a9f730b May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on a9f730b May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on a9f730b May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on a9f730b May 31, 2022

Please sign in to comment.