Skip to content

Commit 9f25a48

Browse files
committed
fix nested subflow error highlighting
1 parent 9f1f77e commit 9f25a48

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ export function useWorkflowExecution() {
491491
updateActiveBlocks(data.blockId, false)
492492
setBlockRunStatus(data.blockId, 'error')
493493

494+
executedBlockIds.add(data.blockId)
495+
accumulatedBlockStates.set(data.blockId, {
496+
output: { error: data.error },
497+
executed: true,
498+
executionTime: data.durationMs || 0,
499+
})
500+
494501
accumulatedBlockLogs.push(
495502
createBlockLogEntry(data, { success: false, output: {}, error: data.error })
496503
)

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,15 @@ export function PreviewWorkflow({
349349
if (block.type === 'loop' || block.type === 'parallel') {
350350
const isSelected = selectedBlockId === blockId
351351
const dimensions = calculateContainerDimensions(blockId, workflowState.blocks)
352-
const subflowExecutionStatus = getSubflowExecutionStatus(blockId)
352+
353+
// Check for direct error on the subflow block itself (e.g., loop resolution errors)
354+
// before falling back to children-derived status
355+
const directExecution = blockExecutionMap.get(blockId)
356+
const subflowExecutionStatus: ExecutionStatus | undefined =
357+
directExecution?.status === 'error'
358+
? 'error'
359+
: (getSubflowExecutionStatus(blockId) ??
360+
(directExecution ? (directExecution.status as ExecutionStatus) : undefined))
353361

354362
nodeArray.push({
355363
id: blockId,

0 commit comments

Comments
 (0)