🚑 (results) Fix results display when variable has null value
This commit is contained in:
@ -6,6 +6,7 @@ import {
|
|||||||
ModalContent,
|
ModalContent,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
|
import { GraphNavigation } from 'db'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { EditorSettingsForm } from './EditorSettingsForm'
|
import { EditorSettingsForm } from './EditorSettingsForm'
|
||||||
|
|
||||||
@ -23,9 +24,11 @@ export const EditorSettingsModal = ({ isOpen, onClose }: Props) => {
|
|||||||
<ModalContent>
|
<ModalContent>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody pt="12" pb="8" px="8">
|
<ModalBody pt="12" pb="8" px="8">
|
||||||
{user?.graphNavigation && (
|
<EditorSettingsForm
|
||||||
<EditorSettingsForm defaultGraphNavigation={user.graphNavigation} />
|
defaultGraphNavigation={
|
||||||
)}
|
user?.graphNavigation ?? GraphNavigation.TRACKPAD
|
||||||
|
}
|
||||||
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -75,6 +75,7 @@ export const convertResultsToTableData = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const variable = answerOrVariable as VariableWithValue
|
const variable = answerOrVariable as VariableWithValue
|
||||||
|
if (variable.value === null) return o
|
||||||
const key = headerCells.find((headerCell) =>
|
const key = headerCells.find((headerCell) =>
|
||||||
headerCell.variableIds?.includes(variable.id)
|
headerCell.variableIds?.includes(variable.id)
|
||||||
)?.label
|
)?.label
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
import { TypebotViewer } from 'bot-engine'
|
import { TypebotViewer } from 'bot-engine'
|
||||||
import {
|
import { AnswerInput, PublicTypebot, Typebot, VariableWithValue } from 'models'
|
||||||
Answer,
|
|
||||||
AnswerInput,
|
|
||||||
PublicTypebot,
|
|
||||||
Typebot,
|
|
||||||
VariableWithValue,
|
|
||||||
} from 'models'
|
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { isDefined, isNotDefined } from 'utils'
|
import { isDefined, isNotDefined } from 'utils'
|
||||||
|
@ -19,7 +19,7 @@ export const parseVariables =
|
|||||||
const variable = variables.find((v) => {
|
const variable = variables.find((v) => {
|
||||||
return matchedVarName === v.name && isDefined(v.value)
|
return matchedVarName === v.name && isDefined(v.value)
|
||||||
}) as VariableWithValue | undefined
|
}) as VariableWithValue | undefined
|
||||||
if (!variable) return ''
|
if (!variable || variable.value === null) return ''
|
||||||
if (options.fieldToParse === 'id') return variable.id
|
if (options.fieldToParse === 'id') return variable.id
|
||||||
const { value } = variable
|
const { value } = variable
|
||||||
if (options.escapeForJson) return jsonParse(value)
|
if (options.escapeForJson) return jsonParse(value)
|
||||||
|
@ -12,7 +12,7 @@ export const variableSchema = z.object({
|
|||||||
export const variableWithValueSchema = z.object({
|
export const variableWithValueSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
value: z.string(),
|
value: z.string().nullable(),
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,6 @@ import {
|
|||||||
Variable,
|
Variable,
|
||||||
InputBlock,
|
InputBlock,
|
||||||
ResultHeaderCell,
|
ResultHeaderCell,
|
||||||
ResultWithAnswers,
|
|
||||||
Answer,
|
Answer,
|
||||||
VariableWithValue,
|
VariableWithValue,
|
||||||
Typebot,
|
Typebot,
|
||||||
@ -209,7 +208,7 @@ export const parseAnswers =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const variable = answerOrVariable as VariableWithValue
|
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 }
|
return { ...o, [variable.name]: variable.value }
|
||||||
}, {}),
|
}, {}),
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user