diff --git a/src/components/activity/ActivityDecomposition.svelte b/src/components/activity/ActivityDecomposition.svelte index d79c717c8e..464c109410 100644 --- a/src/components/activity/ActivityDecomposition.svelte +++ b/src/components/activity/ActivityDecomposition.svelte @@ -14,6 +14,7 @@ export let selectedSpanId: SpanId | null = null; export let spansMap: SpansMap = {}; export let spanUtilityMaps: SpanUtilityMaps; + export let childPageSize: number = 25; const dispatch = createEventDispatcher<{ select: number | null; @@ -21,17 +22,26 @@ let childIds: SpanId[] = []; let span: Span | null = null; + let childLimit = childPageSize; + let isRoot: boolean = true; + let type: string; + let hasChildren: boolean = false; + let role: 'tree' | 'treeitem' = 'tree'; + let nodeClass: string = ''; + let buttonClass: string = ''; + let childIdsInView: SpanId[] = []; $: span = rootSpanId !== null ? spansMap[rootSpanId] : null; $: isRoot = span ? !span.parent_id : true; $: type = span?.type || ''; - $: childIds = span !== null ? spanUtilityMaps?.spanIdToChildIdsMap[span?.id] : []; + $: childIds = span !== null ? spanUtilityMaps?.spanIdToChildIdsMap[span?.id] || [] : []; $: hasChildren = childIds ? childIds.length > 0 : false; $: role = isRoot ? 'tree' : 'treeitem'; $: nodeClass = 'activity-decomposition-node activity-decomposition-' + (rootSpanId === selectedSpanId ? 'selected st-typography-medium' : 'unselected st-typography-body'); $: buttonClass = 'st-button icon' + (!hasChildren ? ' st-button-no-hover' : ''); + $: childIdsInView = childIds.slice(0, childLimit); function toggle() { expanded = !expanded; @@ -68,11 +78,16 @@ {#if hasChildren && expanded}