Skip to content

Commit 89f4c71

Browse files
committed
remove UI level checks
1 parent 8d75135 commit 89f4c71

File tree

3 files changed

+2
-50
lines changed

3 files changed

+2
-50
lines changed

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import {
6161
} from '@/app/workspace/[workspaceId]/w/[workflowId]/utils'
6262
import { useSocket } from '@/app/workspace/providers/socket-provider'
6363
import { getBlock } from '@/blocks'
64-
import { isAnnotationOnlyBlock } from '@/executor/constants'
6564
import { useWorkspaceEnvironment } from '@/hooks/queries/environment'
6665
import { useAutoConnect, useSnapToGridSize } from '@/hooks/queries/general-settings'
6766
import { useCanvasViewport } from '@/hooks/use-canvas-viewport'
@@ -1100,7 +1099,6 @@ const WorkflowContent = React.memo(() => {
11001099
const isAutoConnectSourceCandidate = useCallback((block: BlockState): boolean => {
11011100
if (!block.enabled) return false
11021101
if (block.type === 'response') return false
1103-
if (isAnnotationOnlyBlock(block.type)) return false
11041102
return true
11051103
}, [])
11061104

@@ -1248,26 +1246,13 @@ const WorkflowContent = React.memo(() => {
12481246
position: { x: number; y: number },
12491247
targetBlockId: string,
12501248
options: {
1251-
blockType: string
1252-
enableTriggerMode?: boolean
12531249
targetParentId?: string | null
12541250
existingChildBlocks?: { id: string; type: string; position: { x: number; y: number } }[]
12551251
containerId?: string
12561252
}
12571253
): Edge | undefined => {
12581254
if (!autoConnectRef.current) return undefined
12591255

1260-
// Don't auto-connect starter or annotation-only blocks
1261-
if (options.blockType === 'starter' || isAnnotationOnlyBlock(options.blockType)) {
1262-
return undefined
1263-
}
1264-
1265-
// Check if target is a trigger block
1266-
const targetBlockConfig = getBlock(options.blockType)
1267-
const isTargetTrigger =
1268-
options.enableTriggerMode || targetBlockConfig?.category === 'triggers'
1269-
if (isTargetTrigger) return undefined
1270-
12711256
// Case 1: Adding block inside a container with existing children
12721257
if (options.existingChildBlocks && options.existingChildBlocks.length > 0) {
12731258
const closestBlock = findClosestBlockInSet(options.existingChildBlocks, position)
@@ -1375,7 +1360,6 @@ const WorkflowContent = React.memo(() => {
13751360
const name = getUniqueBlockName(baseName, blocks)
13761361

13771362
const autoConnectEdge = tryCreateAutoConnectEdge(position, id, {
1378-
blockType: data.type,
13791363
targetParentId: null,
13801364
})
13811365

@@ -1446,8 +1430,6 @@ const WorkflowContent = React.memo(() => {
14461430
.map((b) => ({ id: b.id, type: b.type, position: b.position }))
14471431

14481432
const autoConnectEdge = tryCreateAutoConnectEdge(relativePosition, id, {
1449-
blockType: data.type,
1450-
enableTriggerMode: data.enableTriggerMode,
14511433
targetParentId: containerInfo.loopId,
14521434
existingChildBlocks,
14531435
containerId: containerInfo.loopId,
@@ -1476,8 +1458,6 @@ const WorkflowContent = React.memo(() => {
14761458
if (checkTriggerConstraints(data.type)) return
14771459

14781460
const autoConnectEdge = tryCreateAutoConnectEdge(position, id, {
1479-
blockType: data.type,
1480-
enableTriggerMode: data.enableTriggerMode,
14811461
targetParentId: null,
14821462
})
14831463

@@ -1533,7 +1513,6 @@ const WorkflowContent = React.memo(() => {
15331513
const name = getUniqueBlockName(baseName, blocks)
15341514

15351515
const autoConnectEdge = tryCreateAutoConnectEdge(basePosition, id, {
1536-
blockType: type,
15371516
targetParentId: null,
15381517
})
15391518

@@ -1569,8 +1548,6 @@ const WorkflowContent = React.memo(() => {
15691548
const name = getUniqueBlockName(baseName, blocks)
15701549

15711550
const autoConnectEdge = tryCreateAutoConnectEdge(basePosition, id, {
1572-
blockType: type,
1573-
enableTriggerMode,
15741551
targetParentId: null,
15751552
})
15761553

@@ -2371,18 +2348,6 @@ const WorkflowContent = React.memo(() => {
23712348

23722349
if (!sourceNode || !targetNode) return
23732350

2374-
if (
2375-
isAnnotationOnlyBlock(sourceNode.data?.type) ||
2376-
isAnnotationOnlyBlock(targetNode.data?.type)
2377-
) {
2378-
return
2379-
}
2380-
2381-
const targetBlock = blocks[targetNode.id]
2382-
if (targetBlock && TriggerUtils.isTriggerBlock(targetBlock)) {
2383-
return
2384-
}
2385-
23862351
// Get parent information (handle container start node case)
23872352
const sourceParentId =
23882353
blocks[sourceNode.id]?.data?.parentId ||
@@ -2788,7 +2753,6 @@ const WorkflowContent = React.memo(() => {
27882753
.map((b) => ({ id: b.id, type: b.type, position: b.position }))
27892754

27902755
const autoConnectEdge = tryCreateAutoConnectEdge(relativePositionBefore, node.id, {
2791-
blockType: node.data?.type || '',
27922756
targetParentId: potentialParentId,
27932757
existingChildBlocks,
27942758
containerId: potentialParentId,

apps/sim/app/workspace/providers/socket-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export function SocketProvider({ children, user }: SocketProviderProps) {
352352
})
353353
})
354354

355-
useWorkflowStore.setState({
355+
useWorkflowStore.getState().replaceWorkflowState({
356356
blocks: workflowState.blocks || {},
357357
edges: workflowState.edges || [],
358358
loops: workflowState.loops || {},

apps/sim/stores/workflows/workflow/store.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,7 @@ function filterValidEdges(
108108
edges: Edge[],
109109
blocks: Record<string, { type: string; triggerMode?: boolean }>
110110
): Edge[] {
111-
return edges.filter((edge) => {
112-
const valid = isValidEdge(edge, blocks)
113-
if (!valid) {
114-
logger.warn('Filtered invalid edge', {
115-
edgeId: edge.id,
116-
source: edge.source,
117-
target: edge.target,
118-
sourceType: blocks[edge.source]?.type,
119-
targetType: blocks[edge.target]?.type,
120-
})
121-
}
122-
return valid
123-
})
111+
return edges.filter((edge) => isValidEdge(edge, blocks))
124112
}
125113

126114
const initialState = {

0 commit comments

Comments
 (0)