diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx index 169d643a398..890a5a7d4dc 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx @@ -197,7 +197,10 @@ export function Preview({ const childTraceSpans = extractChildTraceSpans(blockExecution) const childBlockExecutions = buildBlockExecutions(childTraceSpans) - const workflowName = childWorkflowState.metadata?.name || 'Nested Workflow' + const workflowName = + childWorkflowState.metadata?.name || + (blockExecution?.output as { childWorkflowName?: string } | undefined)?.childWorkflowName || + 'Nested Workflow' setWorkflowStack((prev) => [ ...prev, diff --git a/apps/sim/executor/handlers/workflow/workflow-handler.ts b/apps/sim/executor/handlers/workflow/workflow-handler.ts index 4821d86029e..8aa478b6e84 100644 --- a/apps/sim/executor/handlers/workflow/workflow-handler.ts +++ b/apps/sim/executor/handlers/workflow/workflow-handler.ts @@ -363,6 +363,10 @@ export class WorkflowBlockHandler implements BlockHandler { const workflowStateWithVariables = { ...workflowState, variables: workflowVariables, + metadata: { + ...(workflowState.metadata || {}), + name: workflowData.name || DEFAULTS.WORKFLOW_NAME, + }, } if (Object.keys(workflowVariables).length > 0) { @@ -444,13 +448,18 @@ export class WorkflowBlockHandler implements BlockHandler { ) const workflowVariables = (wfData?.variables as Record) || {} + const childName = wfData?.name || DEFAULTS.WORKFLOW_NAME const workflowStateWithVariables = { ...deployedState, variables: workflowVariables, + metadata: { + ...(deployedState.metadata || {}), + name: childName, + }, } return { - name: wfData?.name || DEFAULTS.WORKFLOW_NAME, + name: childName, serializedState: serializedWorkflow, variables: workflowVariables, workflowState: workflowStateWithVariables,