fix(results): crash when variable is object
This commit is contained in:
@ -27,7 +27,7 @@ const typebotContext = createContext<{
|
||||
linkedBotQueue: LinkedTypebotQueue
|
||||
isLoading: boolean
|
||||
setCurrentTypebotId: (id: string) => void
|
||||
updateVariableValue: (variableId: string, value: string) => void
|
||||
updateVariableValue: (variableId: string, value: string | number) => void
|
||||
createEdge: (edge: Edge) => void
|
||||
injectLinkedTypebot: (typebot: Typebot | PublicTypebot) => LinkedTypebot
|
||||
popEdgeIdFromLinkedTypebotQueue: () => void
|
||||
|
@ -35,7 +35,7 @@ type IntegrationContext = {
|
||||
groups: Group[]
|
||||
resultId?: string
|
||||
updateVariables: (variables: VariableWithValue[]) => void
|
||||
updateVariableValue: (variableId: string, value: string) => void
|
||||
updateVariableValue: (variableId: string, value: string | number) => void
|
||||
onNewLog: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
|
||||
}
|
||||
|
||||
@ -263,7 +263,12 @@ const executeWebhook = async (
|
||||
)
|
||||
try {
|
||||
const value = func(data)
|
||||
updateVariableValue(existingVariable?.id, value)
|
||||
updateVariableValue(
|
||||
existingVariable?.id,
|
||||
typeof value !== 'number' && typeof value !== 'string'
|
||||
? JSON.stringify(value)
|
||||
: value
|
||||
)
|
||||
return [...newVariables, { ...existingVariable, value }]
|
||||
} catch (err) {
|
||||
return newVariables
|
||||
|
Reference in New Issue
Block a user