2
0

🐛 (editor) Make sure you can't remove the Start group

This commit is contained in:
Baptiste Arnaud
2023-04-03 07:57:01 +02:00
parent 411cf31b39
commit d32afd8ba6

View File

@ -95,6 +95,7 @@ export const blocksAction = (
const removeBlockFromGroup =
({ groupIndex, blockIndex }: BlockIndices) =>
(typebot: WritableDraft<Typebot>) => {
if (typebot.groups[groupIndex].blocks[blockIndex].type === 'start') return
typebot.groups[groupIndex].blocks.splice(blockIndex, 1)
}
@ -205,6 +206,7 @@ export const duplicateBlockDraft =
export const deleteGroupDraft =
(typebot: WritableDraft<Typebot>) => (groupIndex: number) => {
if (typebot.groups[groupIndex].blocks.at(0)?.type === 'start') return
cleanUpEdgeDraft(typebot, typebot.groups[groupIndex].id)
typebot.groups.splice(groupIndex, 1)
}