Skip to content

Commit

Permalink
fix(viewer): 🐛 Avoid variables duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 19, 2022
1 parent 93811a3 commit b175974
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/bot-engine/src/contexts/AnswersContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export const AnswersContext = ({

const updateVariables = (variables: VariableWithValue[]) =>
setResultValues((resultValues) => {
const updatedVariables = [...resultValues.variables, ...variables]
const updatedVariables = [
...resultValues.variables.filter((v) =>
variables.every((variable) => variable.id !== v.id)
),
...variables,
]
if (onVariablesUpdated) onVariablesUpdated(updatedVariables)
return {
...resultValues,
Expand Down

4 comments on commit b175974

@vercel
Copy link

@vercel vercel bot commented on b175974 Apr 19, 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 b175974 Apr 19, 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 b175974 Apr 19, 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

Please sign in to comment.