Skip to content

Commit 1eb85dd

Browse files
authored
fix(preview): show actual nested workflow name in log snapshots (#3689)
* fix(preview): show actual nested workflow name in log snapshots * fix(preview): ensure metadata.name in non-deployed child workflow path * style(preview): fix line formatting
1 parent 0be9303 commit 1eb85dd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ export function Preview({
197197
const childTraceSpans = extractChildTraceSpans(blockExecution)
198198
const childBlockExecutions = buildBlockExecutions(childTraceSpans)
199199

200-
const workflowName = childWorkflowState.metadata?.name || 'Nested Workflow'
200+
const workflowName =
201+
childWorkflowState.metadata?.name ||
202+
(blockExecution?.output as { childWorkflowName?: string } | undefined)?.childWorkflowName ||
203+
'Nested Workflow'
201204

202205
setWorkflowStack((prev) => [
203206
...prev,

apps/sim/executor/handlers/workflow/workflow-handler.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ export class WorkflowBlockHandler implements BlockHandler {
363363
const workflowStateWithVariables = {
364364
...workflowState,
365365
variables: workflowVariables,
366+
metadata: {
367+
...(workflowState.metadata || {}),
368+
name: workflowData.name || DEFAULTS.WORKFLOW_NAME,
369+
},
366370
}
367371

368372
if (Object.keys(workflowVariables).length > 0) {
@@ -444,13 +448,18 @@ export class WorkflowBlockHandler implements BlockHandler {
444448
)
445449

446450
const workflowVariables = (wfData?.variables as Record<string, any>) || {}
451+
const childName = wfData?.name || DEFAULTS.WORKFLOW_NAME
447452
const workflowStateWithVariables = {
448453
...deployedState,
449454
variables: workflowVariables,
455+
metadata: {
456+
...(deployedState.metadata || {}),
457+
name: childName,
458+
},
450459
}
451460

452461
return {
453-
name: wfData?.name || DEFAULTS.WORKFLOW_NAME,
462+
name: childName,
454463
serializedState: serializedWorkflow,
455464
variables: workflowVariables,
456465
workflowState: workflowStateWithVariables,

0 commit comments

Comments
 (0)