fix: parallel id caused append to wrong branch (#17794)

This commit is contained in:
Joel 2025-04-10 17:44:55 +08:00 committed by GitHub
parent 605ab9e46c
commit f8145480fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,7 +74,6 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
console.log(list)
const result: NodeTracing[] = [...list]
const parallelFirstNodeMap: Record<string, string> = {}
// list to tree by parent_parallel_start_node_id and branch by parallel_start_node_id. Each parallel may has more than one branch.
result.forEach((node) => {
const parallel_id = node.parallel_id ?? node.execution_metadata?.parallel_id ?? null
@ -93,7 +92,6 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
isParallelStartNode: true,
children: [selfNode],
}
parallelFirstNodeMap[parallel_id] = node.node_id
const isRootLevel = !parent_parallel_id
if (isRootLevel)
return
@ -121,7 +119,7 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
}
// append to parallel start node and after the same branch
const parallelStartNode = result.find(item => item.node_id === parallelFirstNodeMap[parallel_id])
const parallelStartNode = result.find(item => parallel_start_node_id === item.node_id)
if (parallelStartNode && parallelStartNode.parallelDetail && parallelStartNode!.parallelDetail!.children) {
const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {