fix(results): crash when variable is object
This commit is contained in:
@@ -151,9 +151,6 @@ export const ResultsTable = ({
|
|||||||
[resultHeader]
|
[resultHeader]
|
||||||
)
|
)
|
||||||
|
|
||||||
// TO-DO: remove. Meant to help me investigate why table crash in some specific circumstances.
|
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
const instance = useReactTable({
|
const instance = useReactTable({
|
||||||
data,
|
data,
|
||||||
columns,
|
columns,
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export const convertResultsToTableData = (
|
|||||||
if (isDefined(o[key])) return o
|
if (isDefined(o[key])) return o
|
||||||
return {
|
return {
|
||||||
...o,
|
...o,
|
||||||
[key]: { plainText: variable.value },
|
[key]: { plainText: variable.value?.toString() },
|
||||||
}
|
}
|
||||||
}, {}),
|
}, {}),
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const typebotContext = createContext<{
|
|||||||
linkedBotQueue: LinkedTypebotQueue
|
linkedBotQueue: LinkedTypebotQueue
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
setCurrentTypebotId: (id: string) => void
|
setCurrentTypebotId: (id: string) => void
|
||||||
updateVariableValue: (variableId: string, value: string) => void
|
updateVariableValue: (variableId: string, value: string | number) => void
|
||||||
createEdge: (edge: Edge) => void
|
createEdge: (edge: Edge) => void
|
||||||
injectLinkedTypebot: (typebot: Typebot | PublicTypebot) => LinkedTypebot
|
injectLinkedTypebot: (typebot: Typebot | PublicTypebot) => LinkedTypebot
|
||||||
popEdgeIdFromLinkedTypebotQueue: () => void
|
popEdgeIdFromLinkedTypebotQueue: () => void
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ type IntegrationContext = {
|
|||||||
groups: Group[]
|
groups: Group[]
|
||||||
resultId?: string
|
resultId?: string
|
||||||
updateVariables: (variables: VariableWithValue[]) => void
|
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
|
onNewLog: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,12 @@ const executeWebhook = async (
|
|||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
const value = func(data)
|
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 }]
|
return [...newVariables, { ...existingVariable, value }]
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return newVariables
|
return newVariables
|
||||||
|
|||||||
Reference in New Issue
Block a user