fix(editor): 🚑️ Step id duplication
This commit is contained in:
@ -6,6 +6,7 @@ import {
|
||||
Block,
|
||||
DraggableStep,
|
||||
DraggableStepType,
|
||||
IntegrationStepType,
|
||||
StepIndices,
|
||||
Typebot,
|
||||
} from 'models'
|
||||
@ -65,7 +66,11 @@ const blocksActions = (setTypebot: SetTypebot): BlocksActions => ({
|
||||
...block,
|
||||
title: `${block.title} copy`,
|
||||
id,
|
||||
steps: block.steps.map((s) => ({ ...s, blockId: id })),
|
||||
steps: block.steps.map((s) =>
|
||||
s.type === IntegrationStepType.WEBHOOK
|
||||
? { ...s, blockId: id, id: cuid(), webhookId: cuid() }
|
||||
: { ...s, blockId: id, id: cuid() }
|
||||
),
|
||||
graphCoordinates: {
|
||||
x: block.graphCoordinates.x + 200,
|
||||
y: block.graphCoordinates.y + 100,
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
DraggableStep,
|
||||
DraggableStepType,
|
||||
StepIndices,
|
||||
IntegrationStepType,
|
||||
} from 'models'
|
||||
import { parseNewStep } from 'services/typebots/typebots'
|
||||
import { removeEmptyBlocks } from './blocks'
|
||||
@ -54,7 +55,14 @@ const stepsAction = (setTypebot: SetTypebot): StepsActions => ({
|
||||
produce(typebot, (typebot) => {
|
||||
const step = typebot.blocks[blockIndex].steps[stepIndex]
|
||||
const id = cuid()
|
||||
const newStep: Step = {
|
||||
const newStep: Step =
|
||||
step.type === IntegrationStepType.WEBHOOK
|
||||
? {
|
||||
...step,
|
||||
id,
|
||||
webhookId: cuid(),
|
||||
}
|
||||
: {
|
||||
...step,
|
||||
id,
|
||||
}
|
||||
|
Reference in New Issue
Block a user