2
0

🐛 Fix bug when adding items in array in forged block

Closes #1363
This commit is contained in:
Baptiste Arnaud
2024-03-18 16:15:53 +01:00
parent 884956bf4c
commit c53c90ea64

View File

@ -1,4 +1,9 @@
import { PublicTypebot, PublicTypebotV6, TypebotV6 } from '@typebot.io/schemas' import {
PublicTypebot,
PublicTypebotV6,
TypebotV6,
typebotV6Schema,
} from '@typebot.io/schemas'
import { Router } from 'next/router' import { Router } from 'next/router'
import { import {
createContext, createContext,
@ -215,11 +220,12 @@ export const TypebotProvider = ({
} }
if (dequal(omit(typebot, 'updatedAt'), omit(typebotToSave, 'updatedAt'))) if (dequal(omit(typebot, 'updatedAt'), omit(typebotToSave, 'updatedAt')))
return return
setLocalTypebot({ ...typebotToSave }) const newParsedTypebot = typebotV6Schema.parse({ ...typebotToSave })
setLocalTypebot(newParsedTypebot)
try { try {
await updateTypebot({ await updateTypebot({
typebotId: typebotToSave.id, typebotId: newParsedTypebot.id,
typebot: typebotToSave, typebot: newParsedTypebot,
}) })
} catch { } catch {
setLocalTypebot({ setLocalTypebot({