From 9f25a4893e41327469e1f452e75ef554f659ae6e Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Thu, 5 Feb 2026 15:08:31 -0800 Subject: [PATCH] fix nested subflow error highlighting --- .../w/[workflowId]/hooks/use-workflow-execution.ts | 7 +++++++ .../components/preview-workflow/preview-workflow.tsx | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts index 0b4916a2f..6b1f8914e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts @@ -491,6 +491,13 @@ export function useWorkflowExecution() { updateActiveBlocks(data.blockId, false) setBlockRunStatus(data.blockId, 'error') + executedBlockIds.add(data.blockId) + accumulatedBlockStates.set(data.blockId, { + output: { error: data.error }, + executed: true, + executionTime: data.durationMs || 0, + }) + accumulatedBlockLogs.push( createBlockLogEntry(data, { success: false, output: {}, error: data.error }) ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx index 0e6948ac4..cdad58544 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx @@ -349,7 +349,15 @@ export function PreviewWorkflow({ if (block.type === 'loop' || block.type === 'parallel') { const isSelected = selectedBlockId === blockId const dimensions = calculateContainerDimensions(blockId, workflowState.blocks) - const subflowExecutionStatus = getSubflowExecutionStatus(blockId) + + // Check for direct error on the subflow block itself (e.g., loop resolution errors) + // before falling back to children-derived status + const directExecution = blockExecutionMap.get(blockId) + const subflowExecutionStatus: ExecutionStatus | undefined = + directExecution?.status === 'error' + ? 'error' + : (getSubflowExecutionStatus(blockId) ?? + (directExecution ? (directExecution.status as ExecutionStatus) : undefined)) nodeArray.push({ id: blockId,