Skip to content

improvement(autoconnect): click to add paths also autoconnect - #2737

Merged
icecrasher321 merged 1 commit into
stagingfrom
improvement/autoconnect-click
Jan 9, 2026
Merged

improvement(autoconnect): click to add paths also autoconnect#2737
icecrasher321 merged 1 commit into
stagingfrom
improvement/autoconnect-click

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Click to add block paths [cmd k and toolbar] should also create autoconnect edges.

Type of Change

  • Other: UX Improvement

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

vercelBot commented Jan 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedJan 9, 2026 2:05am

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Adds auto-connect functionality to toolbar click events (Cmd+K and toolbar clicks), matching the existing drag-and-drop behavior. When users add blocks via these methods, edges are now automatically created to the closest suitable output block.

Major changes:

  • Modified handleAddBlockFromToolbar event handler to call tryCreateAutoConnectEdge before adding blocks
  • Added tryCreateAutoConnectEdge to the useEffect dependency array
  • Updated settings label from "Auto-connect on drag" to "Auto-connect on drop"

Minor concern:

  • The settings label "Auto-connect on drop" doesn't fully reflect that the feature now applies to both drag-drop AND click-to-add operations

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The implementation correctly adds auto-connect functionality to click-to-add operations using the same battle-tested logic as drag-and-drop. Code follows existing patterns and maintains consistency. Only minor concern is a slightly misleading UI label that could be improved for clarity.
  • No files require special attention - the implementation is straightforward and consistent with existing patterns

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx4/5Added auto-connect edge creation for toolbar click events (Cmd+K and toolbar clicks) to match drag-and-drop behavior. Implementation is consistent and correct.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/general/general.tsx3/5Updated label from 'Auto-connect on drag' to 'Auto-connect on drop', though this doesn't fully reflect that the feature now also applies to click-to-add operations.

Sequence Diagram

sequenceDiagram
participant User
participant Toolbar/CmdK
participant WorkflowContent
participant tryCreateAutoConnectEdge
participant findClosestOutput
participant addBlock
User->>Toolbar/CmdK: Click to add block
Toolbar/CmdK->>WorkflowContent: dispatch 'add-block-from-toolbar' event
WorkflowContent->>WorkflowContent: getViewportCenter()
WorkflowContent->>WorkflowContent: checkTriggerConstraints()
WorkflowContent->>tryCreateAutoConnectEdge: call with position & block info
tryCreateAutoConnectEdge->>tryCreateAutoConnectEdge: check isAutoConnectEnabled
alt Auto-connect enabled
tryCreateAutoConnectEdge->>findClosestOutput: find closest block to position
findClosestOutput->>findClosestOutput: filter blocks by container context
findClosestOutput-->>tryCreateAutoConnectEdge: return closest block
tryCreateAutoConnectEdge->>tryCreateAutoConnectEdge: create edge object
tryCreateAutoConnectEdge-->>WorkflowContent: return Edge
else Auto-connect disabled
tryCreateAutoConnectEdge-->>WorkflowContent: return undefined
end
WorkflowContent->>addBlock: add block with optional edge
addBlock->>addBlock: collaborativeBatchAddBlocks(block, edges)
Loading

@icecrasher321
icecrasher321 merged commit e5c9509 into stagingJan 9, 2026
10 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/autoconnect-click branch January 10, 2026 08:21
Sign up for freeto 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.

1 participant

@icecrasher321