Skip to content

Commit 1bd97ff

Browse files
committed
address comments
1 parent 20312df commit 1bd97ff

File tree

7 files changed

+12
-74
lines changed

7 files changed

+12
-74
lines changed

apps/sim/app/api/workflows/[id]/execute/route.async.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const {
1919

2020
vi.mock('@/lib/auth/hybrid', () => ({
2121
checkHybridAuth: mockCheckHybridAuth,
22+
AuthType: {
23+
SESSION: 'session',
24+
API_KEY: 'api_key',
25+
INTERNAL_JWT: 'internal_jwt',
26+
},
2227
}))
2328

2429
vi.mock('@/lib/workflows/utils', () => ({

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/subflow-node.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ export const SubflowNodeComponent = memo(({ data, id, selected }: NodeProps<Subf
199199

200200
{/*
201201
* Subflow body background. Uses pointer-events: none so that edges rendered
202-
* inside the subflow remain clickable. Subflow selection when clicking the
203-
* empty body area is handled by React Flow's native onNodeClick which fires
204-
* on the node wrapper element surrounding this component.
202+
* inside the subflow remain clickable. The subflow node wrapper also has
203+
* pointer-events: none (set in workflow.tsx), so body-area clicks pass
204+
* through to the pane. Subflow selection is done via the header above.
205205
*/}
206206
<div
207207
className='absolute inset-0 top-[44px] rounded-b-[8px]'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3628,7 +3628,7 @@ const WorkflowContent = React.memo(() => {
36283628
return hasConflict ? resolved : updated
36293629
})
36303630
},
3631-
[setNodes, blocks]
3631+
[setNodes]
36323632
)
36333633

36343634
/** Handles edge selection with container context tracking and Shift-click multi-selection. */

apps/sim/lib/copilot/tools/server/workflow/edit-workflow/builders.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,9 @@ export function normalizeConditionRouterIds(blockId: string, key: string, value:
303303

304304
let canonicalId: string
305305
if (key === 'conditions') {
306-
const title = typeof item.title === 'string' ? item.title.toLowerCase() : ''
307-
if (index === 0 || title === 'if') {
306+
if (index === 0) {
308307
canonicalId = `${blockId}-if`
309-
} else if (index === parsed.length - 1 || title === 'else') {
308+
} else if (index === parsed.length - 1) {
310309
canonicalId = `${blockId}-else`
311310
} else {
312311
canonicalId = `${blockId}-else-if-${elseIfCounter}`

apps/sim/lib/copilot/tools/server/workflow/edit-workflow/validation.ts

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -393,69 +393,6 @@ export function validateValueForSubBlockType(
393393
}
394394
}
395395

396-
export function validateWorkflowBranchIds(workflowState: any): ValidationError[] {
397-
const errors: ValidationError[] = []
398-
399-
for (const [blockId, rawBlock] of Object.entries(workflowState.blocks || {})) {
400-
const block = rawBlock as any
401-
if (!block?.type || !block?.subBlocks) continue
402-
403-
if (block.type === 'condition') {
404-
const subBlock = block.subBlocks.conditions
405-
if (!subBlock) continue
406-
407-
if (subBlock.type !== 'condition-input') {
408-
errors.push({
409-
blockId,
410-
blockType: block.type,
411-
field: 'conditions',
412-
value: subBlock.type,
413-
error: `Condition block has invalid subblock type "${subBlock.type}" for "conditions" - expected "condition-input"`,
414-
})
415-
}
416-
417-
const validation = validateValueForSubBlockType(
418-
{ id: 'conditions', type: 'condition-input' } as SubBlockConfig,
419-
subBlock.value,
420-
'conditions',
421-
block.type,
422-
blockId
423-
)
424-
if (!validation.valid && validation.error) {
425-
errors.push(validation.error)
426-
}
427-
}
428-
429-
if (block.type === 'router_v2') {
430-
const subBlock = block.subBlocks.routes
431-
if (!subBlock) continue
432-
433-
if (subBlock.type !== 'router-input') {
434-
errors.push({
435-
blockId,
436-
blockType: block.type,
437-
field: 'routes',
438-
value: subBlock.type,
439-
error: `Router block has invalid subblock type "${subBlock.type}" for "routes" - expected "router-input"`,
440-
})
441-
}
442-
443-
const validation = validateValueForSubBlockType(
444-
{ id: 'routes', type: 'router-input' } as SubBlockConfig,
445-
subBlock.value,
446-
'routes',
447-
block.type,
448-
blockId
449-
)
450-
if (!validation.valid && validation.error) {
451-
errors.push(validation.error)
452-
}
453-
}
454-
}
455-
456-
return errors
457-
}
458-
459396
/**
460397
* Validates source handle is valid for the block type
461398
*/

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,9 +909,6 @@ export const useWorkflowStore = create<WorkflowStore>()(
909909
},
910910
},
911911
},
912-
edges: [...state.edges],
913-
loops: { ...state.loops },
914-
parallels: { ...state.parallels },
915912
}
916913
})
917914
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { validateEdges } from '@/stores/workflows/workflow/edge-validation'
12
import type { WorkflowState } from '@/stores/workflows/workflow/types'
23
import { generateLoopBlocks, generateParallelBlocks } from '@/stores/workflows/workflow/utils'
3-
import { validateEdges } from './edge-validation'
44

55
export interface NormalizationResult {
66
state: WorkflowState

0 commit comments

Comments
 (0)