🚑 (results) Fix results display when variable has null value
This commit is contained in:
@ -19,7 +19,7 @@ export const parseVariables =
|
||||
const variable = variables.find((v) => {
|
||||
return matchedVarName === v.name && isDefined(v.value)
|
||||
}) as VariableWithValue | undefined
|
||||
if (!variable) return ''
|
||||
if (!variable || variable.value === null) return ''
|
||||
if (options.fieldToParse === 'id') return variable.id
|
||||
const { value } = variable
|
||||
if (options.escapeForJson) return jsonParse(value)
|
||||
|
@ -12,7 +12,7 @@ export const variableSchema = z.object({
|
||||
export const variableWithValueSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
value: z.string(),
|
||||
value: z.string().nullable(),
|
||||
})
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,6 @@ import {
|
||||
Variable,
|
||||
InputBlock,
|
||||
ResultHeaderCell,
|
||||
ResultWithAnswers,
|
||||
Answer,
|
||||
VariableWithValue,
|
||||
Typebot,
|
||||
@ -209,7 +208,7 @@ export const parseAnswers =
|
||||
}
|
||||
}
|
||||
const variable = answerOrVariable as VariableWithValue
|
||||
if (isDefined(o[variable.name])) return o
|
||||
if (isDefined(o[variable.name]) || variable.value === null) return o
|
||||
return { ...o, [variable.name]: variable.value }
|
||||
}, {}),
|
||||
}
|
||||
|
Reference in New Issue
Block a user