add ref children

This commit is contained in:
Fine 2025-03-10 17:12:51 +08:00
parent b5035bbfd7
commit 39bc8069e0

View File

@ -93,7 +93,7 @@ limitations under the License. -->
return; return;
} }
if (node.spanId === spanId && node.segmentId === segmentId) { if (node.spanId === spanId && node.segmentId === segmentId) {
node.children.push(data); node.refChildren.push(data);
return; return;
} }
for (const nodeItem of node.children || []) { for (const nodeItem of node.children || []) {
@ -239,6 +239,7 @@ limitations under the License. -->
for (const id of Object.keys(segmentGroup)) { for (const id of Object.keys(segmentGroup)) {
const currentSegment = segmentGroup[id].sort((a: Span, b: Span) => b.parentSpanId - a.parentSpanId); const currentSegment = segmentGroup[id].sort((a: Span, b: Span) => b.parentSpanId - a.parentSpanId);
for (const span of currentSegment) { for (const span of currentSegment) {
span.refChildren = [];
const index = currentSegment.findIndex((i: Span) => i.spanId === span.parentSpanId); const index = currentSegment.findIndex((i: Span) => i.spanId === span.parentSpanId);
if (index > -1) { if (index > -1) {
if ( if (
@ -257,7 +258,7 @@ limitations under the License. -->
), ),
); );
if (children.length) { if (children.length) {
span.children.push(...children); span.refChildren.push(...children);
} }
} }
} }