Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address comments
  • Loading branch information
icecrasher321 committed Mar 13, 2026
commit 1bd97ffe5bd1d9a62d6824566ef5a7146eecb1bf
5 changes: 5 additions & 0 deletions apps/sim/app/api/workflows/[id]/execute/route.async.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const {

vi.mock('@/lib/auth/hybrid', () => ({
checkHybridAuth: mockCheckHybridAuth,
AuthType: {
SESSION: 'session',
API_KEY: 'api_key',
INTERNAL_JWT: 'internal_jwt',
},
}))

vi.mock('@/lib/workflows/utils', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export const SubflowNodeComponent = memo(({ data, id, selected }: NodeProps<Subf

{/*
* Subflow body background. Uses pointer-events: none so that edges rendered
* inside the subflow remain clickable. Subflow selection when clicking the
* empty body area is handled by React Flow's native onNodeClick which fires
* on the node wrapper element surrounding this component.
* inside the subflow remain clickable. The subflow node wrapper also has
* pointer-events: none (set in workflow.tsx), so body-area clicks pass
* through to the pane. Subflow selection is done via the header above.
*/}
<div
className='absolute inset-0 top-[44px] rounded-b-[8px]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3628,7 +3628,7 @@ const WorkflowContent = React.memo(() => {
return hasConflict ? resolved : updated
})
},
[setNodes, blocks]
[setNodes]
)

/** Handles edge selection with container context tracking and Shift-click multi-selection. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,9 @@ export function normalizeConditionRouterIds(blockId: string, key: string, value:

let canonicalId: string
if (key === 'conditions') {
const title = typeof item.title === 'string' ? item.title.toLowerCase() : ''
if (index === 0 || title === 'if') {
if (index === 0) {
canonicalId = `${blockId}-if`
} else if (index === parsed.length - 1 || title === 'else') {
} else if (index === parsed.length - 1) {
canonicalId = `${blockId}-else`
} else {
canonicalId = `${blockId}-else-if-${elseIfCounter}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,69 +393,6 @@ export function validateValueForSubBlockType(
}
}

export function validateWorkflowBranchIds(workflowState: any): ValidationError[] {
const errors: ValidationError[] = []

for (const [blockId, rawBlock] of Object.entries(workflowState.blocks || {})) {
const block = rawBlock as any
if (!block?.type || !block?.subBlocks) continue

if (block.type === 'condition') {
const subBlock = block.subBlocks.conditions
if (!subBlock) continue

if (subBlock.type !== 'condition-input') {
errors.push({
blockId,
blockType: block.type,
field: 'conditions',
value: subBlock.type,
error: `Condition block has invalid subblock type "${subBlock.type}" for "conditions" - expected "condition-input"`,
})
}

const validation = validateValueForSubBlockType(
{ id: 'conditions', type: 'condition-input' } as SubBlockConfig,
subBlock.value,
'conditions',
block.type,
blockId
)
if (!validation.valid && validation.error) {
errors.push(validation.error)
}
}

if (block.type === 'router_v2') {
const subBlock = block.subBlocks.routes
if (!subBlock) continue

if (subBlock.type !== 'router-input') {
errors.push({
blockId,
blockType: block.type,
field: 'routes',
value: subBlock.type,
error: `Router block has invalid subblock type "${subBlock.type}" for "routes" - expected "router-input"`,
})
}

const validation = validateValueForSubBlockType(
{ id: 'routes', type: 'router-input' } as SubBlockConfig,
subBlock.value,
'routes',
block.type,
blockId
)
if (!validation.valid && validation.error) {
errors.push(validation.error)
}
}
}

return errors
}

/**
* Validates source handle is valid for the block type
*/
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/stores/workflows/workflow/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,6 @@ export const useWorkflowStore = create<WorkflowStore>()(
},
},
},
edges: [...state.edges],
loops: { ...state.loops },
parallels: { ...state.parallels },
}
})
},
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/stores/workflows/workflow/validation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { validateEdges } from '@/stores/workflows/workflow/edge-validation'
import type { WorkflowState } from '@/stores/workflows/workflow/types'
import { generateLoopBlocks, generateParallelBlocks } from '@/stores/workflows/workflow/utils'
import { validateEdges } from './edge-validation'

export interface NormalizationResult {
state: WorkflowState
Expand Down
Loading