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 ed5096e2b6
commit 56a23a14b6

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 {
createContext,
@ -215,11 +220,12 @@ export const TypebotProvider = ({
}
if (dequal(omit(typebot, 'updatedAt'), omit(typebotToSave, 'updatedAt')))
return
setLocalTypebot({ ...typebotToSave })
const newParsedTypebot = typebotV6Schema.parse({ ...typebotToSave })
setLocalTypebot(newParsedTypebot)
try {
await updateTypebot({
typebotId: typebotToSave.id,
typebot: typebotToSave,
typebotId: newParsedTypebot.id,
typebot: newParsedTypebot,
})
} catch {
setLocalTypebot({