Skip to content

Commit e5c9509

Browse files
improvement(autoconnect): click to add paths also autoconnect (#2737)
1 parent b87af80 commit e5c9509

File tree

2 files changed

+15
-3
lines changed
  • apps/sim/app/workspace/[workspaceId]/w

2 files changed

+15
-3
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,11 @@ const WorkflowContent = React.memo(() => {
13371337
const baseName = type === 'loop' ? 'Loop' : 'Parallel'
13381338
const name = getUniqueBlockName(baseName, blocks)
13391339

1340+
const autoConnectEdge = tryCreateAutoConnectEdge(basePosition, id, {
1341+
blockType: type,
1342+
targetParentId: null,
1343+
})
1344+
13401345
addBlock(
13411346
id,
13421347
type,
@@ -1349,7 +1354,7 @@ const WorkflowContent = React.memo(() => {
13491354
},
13501355
undefined,
13511356
undefined,
1352-
undefined
1357+
autoConnectEdge
13531358
)
13541359

13551360
return
@@ -1368,6 +1373,12 @@ const WorkflowContent = React.memo(() => {
13681373
const baseName = defaultTriggerName || blockConfig.name
13691374
const name = getUniqueBlockName(baseName, blocks)
13701375

1376+
const autoConnectEdge = tryCreateAutoConnectEdge(basePosition, id, {
1377+
blockType: type,
1378+
enableTriggerMode,
1379+
targetParentId: null,
1380+
})
1381+
13711382
addBlock(
13721383
id,
13731384
type,
@@ -1376,7 +1387,7 @@ const WorkflowContent = React.memo(() => {
13761387
undefined,
13771388
undefined,
13781389
undefined,
1379-
undefined,
1390+
autoConnectEdge,
13801391
enableTriggerMode
13811392
)
13821393
}
@@ -1395,6 +1406,7 @@ const WorkflowContent = React.memo(() => {
13951406
addBlock,
13961407
effectivePermissions.canEdit,
13971408
checkTriggerConstraints,
1409+
tryCreateAutoConnectEdge,
13981410
])
13991411

14001412
/**

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/general/general.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export function General({ onOpenChange }: GeneralProps) {
480480
</div>
481481

482482
<div className='flex items-center justify-between'>
483-
<Label htmlFor='auto-connect'>Auto-connect on drag</Label>
483+
<Label htmlFor='auto-connect'>Auto-connect on drop</Label>
484484
<Switch
485485
id='auto-connect'
486486
checked={settings?.autoConnect ?? true}

0 commit comments

Comments
 (0)