fix(editor): Cannot expand sub execution log if it finished with an error (#16236)

Co-authored-by: Csaba Tuncsik <csaba.tuncsik@gmail.com>
This commit is contained in:
Suguru Inoue
2025-06-16 12:09:45 +02:00
committed by GitHub
parent 701816aae1
commit 3fcabd40b3
6 changed files with 77 additions and 22 deletions

View File

@@ -10,6 +10,8 @@ import {
type Workflow,
type INode,
type ISourceData,
parseErrorMetadata,
type RelatedExecution,
} from 'n8n-workflow';
import type { LogEntry, LogEntrySelection, LogTreeCreationContext } from './logs.types';
import { isProxy, isReactive, isRef, toRaw } from 'vue';
@@ -70,13 +72,13 @@ function getChildNodes(
runIndex: number | undefined,
context: LogTreeCreationContext,
) {
if (hasSubExecution(treeNode)) {
const workflowId = treeNode.runData?.metadata?.subExecution?.workflowId;
const executionId = treeNode.runData?.metadata?.subExecution?.executionId;
const workflow = workflowId ? context.workflows[workflowId] : undefined;
const subWorkflowRunData = executionId ? context.subWorkflowData[executionId] : undefined;
const subExecutionLocator = findSubExecutionLocator(treeNode);
if (!workflow || !subWorkflowRunData || !executionId) {
if (subExecutionLocator !== undefined) {
const workflow = context.workflows[subExecutionLocator.workflowId];
const subWorkflowRunData = context.subWorkflowData[subExecutionLocator.executionId];
if (!workflow || !subWorkflowRunData) {
return [];
}
@@ -85,7 +87,7 @@ function getChildNodes(
parent: treeNode,
depth: context.depth + 1,
workflow,
executionId,
executionId: subExecutionLocator.executionId,
data: subWorkflowRunData,
});
}
@@ -434,7 +436,17 @@ export function mergeStartData(
}
export function hasSubExecution(entry: LogEntry): boolean {
return !!entry.runData?.metadata?.subExecution;
return findSubExecutionLocator(entry) !== undefined;
}
export function findSubExecutionLocator(entry: LogEntry): RelatedExecution | undefined {
const metadata = entry.runData?.metadata?.subExecution;
if (metadata) {
return { workflowId: metadata.workflowId, executionId: metadata.executionId };
}
return parseErrorMetadata(entry.runData?.error)?.subExecution;
}
export function getDefaultCollapsedEntries(entries: LogEntry[]): Record<string, boolean> {