File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed
apps/sim/app/workspace/[workspaceId]/w/[workflowId] Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -622,23 +622,24 @@ const WorkflowContent = React.memo(() => {
622622 const pasteData = preparePasteData ( pasteOffset )
623623 if ( pasteData ) {
624624 const pastedBlocks = Object . values ( pasteData . blocks )
625- const hasTriggerInPaste = pastedBlocks . some ( ( block ) =>
626- TriggerUtils . isAnyTriggerType ( block . type )
627- )
628- if ( hasTriggerInPaste ) {
629- const existingTrigger = Object . values ( blocks ) . find ( ( block ) =>
630- TriggerUtils . isAnyTriggerType ( block . type )
631- )
632- if ( existingTrigger ) {
633- addNotification ( {
634- level : 'error' ,
635- message :
636- 'A workflow can only have one trigger block. Please remove the existing one before pasting.' ,
637- workflowId : activeWorkflowId || undefined ,
638- } )
639- return
625+ for ( const block of pastedBlocks ) {
626+ if ( TriggerUtils . isAnyTriggerType ( block . type ) ) {
627+ const issue = TriggerUtils . getTriggerAdditionIssue ( blocks , block . type )
628+ if ( issue ) {
629+ const message =
630+ issue . issue === 'legacy'
631+ ? 'Cannot paste trigger blocks when a legacy Start block exists.'
632+ : `A workflow can only have one ${ issue . triggerName } trigger block. Please remove the existing one before pasting.`
633+ addNotification ( {
634+ level : 'error' ,
635+ message,
636+ workflowId : activeWorkflowId || undefined ,
637+ } )
638+ return
639+ }
640640 }
641641 }
642+
642643 collaborativeBatchAddBlocks (
643644 pastedBlocks ,
644645 pasteData . edges ,
You can’t perform that action at this time.
0 commit comments