2
0

feat(engine): ⚗️ Await for result update

This commit is contained in:
Baptiste Arnaud
2022-05-22 08:33:50 -07:00
parent 350719c793
commit 391aeaddf1
4 changed files with 8 additions and 8 deletions

View File

@@ -32,11 +32,11 @@ export const InputChatStep = ({
? variableId && typebot.variables.find(byId(variableId))?.value
: undefined
const handleSubmit = (content: string) => {
const handleSubmit = async (content: string) => {
setAnswer(content)
const isRetry = !isInputValid(content, step.type)
if (!isRetry)
addAnswer({
if (!isRetry && addAnswer)
await addAnswer({
stepId: step.id,
blockId: step.blockId,
content,

View File

@@ -30,7 +30,7 @@ export type TypebotViewerProps = {
predefinedVariables?: { [key: string]: string | undefined }
resultId?: string
onNewBlockVisible?: (edge: Edge) => void
onNewAnswer?: (answer: Answer) => void
onNewAnswer?: (answer: Answer) => Promise<void>
onNewLog?: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
onCompleted?: () => void
onVariablesUpdated?: (variables: VariableWithValue[]) => void