feat(engine): ⚗️ Await for result update
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user