Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Only single instance triggers should show notification. Pasting schedules onto workflow with start should not error.

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 31, 2025 11:31am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 31, 2025

Greptile Summary

Refined paste validation logic to correctly handle trigger block constraints. Previously, the code prevented pasting any trigger when another trigger existed, which was overly restrictive. The new implementation uses TriggerUtils.getTriggerAdditionIssue() to check per-trigger-type constraints, allowing multiple instances of schedules and webhooks while still enforcing single-instance rules for API, Chat, Manual, Input, and Start triggers.

Key improvements:

  • Replaced broad trigger check with granular per-trigger validation
  • Schedules and webhooks can now be pasted into workflows with existing start blocks
  • Enhanced error messages distinguish between legacy starter conflicts and duplicate single-instance triggers
  • Maintains backward compatibility with legacy starter block validation

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change correctly fixes an overly broad validation check by delegating to a well-tested utility method that properly handles trigger type constraints. The logic aligns with the trigger system's design (single-instance for some triggers, multi-instance for others), and the fix resolves the reported bug without introducing new edge cases
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Fixed paste validation to only block single-instance triggers, allowing schedules and webhooks to be pasted correctly

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowContent
    participant TriggerUtils
    participant NotificationSystem

    User->>WorkflowContent: Paste (Ctrl/Cmd+V)
    WorkflowContent->>WorkflowContent: preparePasteData()
    
    loop For each pasted block
        WorkflowContent->>TriggerUtils: isAnyTriggerType(block.type)?
        TriggerUtils-->>WorkflowContent: true/false
        
        alt Is trigger block
            WorkflowContent->>TriggerUtils: getTriggerAdditionIssue(blocks, block.type)
            TriggerUtils->>TriggerUtils: wouldViolateSingleInstance()?
            
            alt No constraint violation (e.g., Schedule)
                TriggerUtils-->>WorkflowContent: null
                Note over WorkflowContent: Continue to next block
            else Single-instance violation
                TriggerUtils->>TriggerUtils: Check if legacy or duplicate issue
                TriggerUtils-->>WorkflowContent: { issue: 'legacy'/'duplicate', triggerName }
                WorkflowContent->>NotificationSystem: addNotification(error)
                NotificationSystem-->>User: Display error message
                WorkflowContent-->>User: Abort paste operation
            end
        end
    end
    
    alt All validation passed
        WorkflowContent->>WorkflowContent: collaborativeBatchAddBlocks()
        WorkflowContent-->>User: Blocks pasted successfully
    end
Loading

@icecrasher321 icecrasher321 merged commit 1ed746b into staging Dec 31, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants