🐛 Fix crash when outgoing edge blockId does not exist
This commit is contained in:
@ -130,6 +130,11 @@ const moveBlockToGroup = (
|
||||
: (newBlock.outgoingEdgeId = undefined)
|
||||
}
|
||||
}
|
||||
typebot.edges.forEach((edge) => {
|
||||
if (edge.to.blockId === block.id) {
|
||||
edge.to.groupId = groupId
|
||||
}
|
||||
})
|
||||
typebot.groups[groupIndex].blocks.splice(blockIndex ?? 0, 0, newBlock)
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Instantiates a single instance PrismaClient and save it on the global object.
|
||||
* @link https://www.prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices
|
||||
*/
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import { PrismaClient } from 'db'
|
||||
|
||||
const prismaGlobal = global as typeof global & {
|
||||
prisma?: PrismaClient
|
||||
|
@ -78,7 +78,10 @@ export const ConversationContainer = ({
|
||||
onNewGroupVisible(nextEdge)
|
||||
setDisplayedGroups([
|
||||
...displayedGroups,
|
||||
{ group: nextGroup, startBlockIndex },
|
||||
{
|
||||
group: nextGroup,
|
||||
startBlockIndex: startBlockIndex === -1 ? 0 : startBlockIndex,
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user