Skip to content

Commit 044b237

Browse files
authored
fix(nextjs-insight): Filter spans without component type from tree view (#92017)
- fixes JAVASCRIPT-30S4
1 parent 620452a commit 044b237

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

static/app/views/insights/pages/platform/nextjs/ssrTreeWidget.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {useTransactionNameQuery} from 'sentry/views/insights/pages/platform/shar
3838

3939
interface TreeResponseItem {
4040
'avg(span.duration)': number;
41-
'function.nextjs.component_type': string;
41+
'function.nextjs.component_type': string | null;
4242
'function.nextjs.path': string[];
4343
'span.description': string;
4444
}
@@ -99,9 +99,13 @@ export function mapResponseToTree(response: TreeResponseItem[]): TreeContainer {
9999
const path = item['function.nextjs.path'];
100100
let currentFolder: TreeContainer = root;
101101

102-
const {file, functionName} = getFileAndFunctionName(
103-
item['function.nextjs.component_type']
104-
);
102+
// Custom spans with span.op:function.nextjs will not have a component type and cannot be added to the tree
103+
const componentType = item['function.nextjs.component_type'];
104+
if (!componentType) {
105+
continue;
106+
}
107+
108+
const {file, functionName} = getFileAndFunctionName(componentType);
105109

106110
const fullPath = [...path];
107111
if (file) {

0 commit comments

Comments
 (0)