mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-07 22:24:06 -05:00
fix(paste): single instance trigger notification correction (#2653)
This commit is contained in:
committed by
GitHub
parent
bf5d0a5573
commit
1ed746bacf
@@ -622,23 +622,24 @@ const WorkflowContent = React.memo(() => {
|
|||||||
const pasteData = preparePasteData(pasteOffset)
|
const pasteData = preparePasteData(pasteOffset)
|
||||||
if (pasteData) {
|
if (pasteData) {
|
||||||
const pastedBlocks = Object.values(pasteData.blocks)
|
const pastedBlocks = Object.values(pasteData.blocks)
|
||||||
const hasTriggerInPaste = pastedBlocks.some((block) =>
|
for (const block of pastedBlocks) {
|
||||||
TriggerUtils.isAnyTriggerType(block.type)
|
if (TriggerUtils.isAnyTriggerType(block.type)) {
|
||||||
)
|
const issue = TriggerUtils.getTriggerAdditionIssue(blocks, block.type)
|
||||||
if (hasTriggerInPaste) {
|
if (issue) {
|
||||||
const existingTrigger = Object.values(blocks).find((block) =>
|
const message =
|
||||||
TriggerUtils.isAnyTriggerType(block.type)
|
issue.issue === 'legacy'
|
||||||
)
|
? 'Cannot paste trigger blocks when a legacy Start block exists.'
|
||||||
if (existingTrigger) {
|
: `A workflow can only have one ${issue.triggerName} trigger block. Please remove the existing one before pasting.`
|
||||||
addNotification({
|
addNotification({
|
||||||
level: 'error',
|
level: 'error',
|
||||||
message:
|
message,
|
||||||
'A workflow can only have one trigger block. Please remove the existing one before pasting.',
|
workflowId: activeWorkflowId || undefined,
|
||||||
workflowId: activeWorkflowId || undefined,
|
})
|
||||||
})
|
return
|
||||||
return
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
collaborativeBatchAddBlocks(
|
collaborativeBatchAddBlocks(
|
||||||
pastedBlocks,
|
pastedBlocks,
|
||||||
pasteData.edges,
|
pasteData.edges,
|
||||||
|
|||||||
Reference in New Issue
Block a user