Browse Source

fix(profiling): single project unsupported empty state (#46060)

Fix for the following thread:
https://sentry.slack.com/archives/C02MYEFL2Q7/p1679324401337959
Elias Hussary 2 years ago
parent
commit
a1841b8d0a

+ 5 - 1
static/app/components/profiling/ProfilingOnboarding/profilingOnboardingSidebar.tsx

@@ -56,7 +56,11 @@ export function ProfilingOnboardingSidebar(props: CommonSidebarProps) {
       }
 
       setCurrentProject(
-        unsupportedProjects.find(p => p.id === String(pageFilters.selection.projects[0]))
+        // there's an edge case where an org w/ a single project may be unsupported but for whatever reason there is no project selection so we can't select a project
+        // in those cases we'll simply default to the first unsupportedProject
+        unsupportedProjects.find(
+          p => p.id === String(pageFilters.selection.projects[0])
+        ) ?? unsupportedProjects[0]
       );
       return;
     }