Skip to content

Commit e7ad3f7

Browse files
committed
fix(terminal): expand workflow blocks nested inside loop/parallel iterations
1 parent 2345756 commit e7ad3f7

File tree

1 file changed

+17
-6
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal

1 file changed

+17
-6
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,23 @@ function buildEntryTree(entries: ConsoleEntry[]): EntryNode[] {
384384
iterationContainerId: iterGroup.iterationContainerId,
385385
}
386386

387-
// Block nodes within this iteration
388-
const blockNodes: EntryNode[] = iterBlocks.map((block) => ({
389-
entry: block,
390-
children: [],
391-
nodeType: 'block' as const,
392-
}))
387+
// Block nodes within this iteration — workflow blocks get their full subtree
388+
const blockNodes: EntryNode[] = iterBlocks.map((block) => {
389+
if (isWorkflowBlockType(block.blockType)) {
390+
const allDescendants = collectWorkflowDescendants(block.blockId, workflowChildGroups)
391+
const rawChildren = allDescendants.map((c) => ({
392+
...c,
393+
childWorkflowBlockId:
394+
c.childWorkflowBlockId === block.blockId ? undefined : c.childWorkflowBlockId,
395+
}))
396+
return {
397+
entry: block,
398+
children: buildEntryTree(rawChildren),
399+
nodeType: 'workflow' as const,
400+
}
401+
}
402+
return { entry: block, children: [], nodeType: 'block' as const }
403+
})
393404

394405
return {
395406
entry: syntheticIteration,

0 commit comments

Comments
 (0)