Browse Source

fix(profiling): enable wizard for nextjs (#46947)

Jonas 1 year ago
parent
commit
c0e7a7c5d2

+ 14 - 0
static/app/components/profiling/ProfilingOnboarding/util.ts

@@ -32,9 +32,18 @@ export const supportedPlatformExpectedDocKeys: Record<
   python: ['0-alert', '1-install', '2-configure-performance', '3-configure-profiling'],
   php: ['0-alert', '1-install', '2-configure-performance', '3-configure-profiling'],
   rust: ['0-alert', '1-install', '2-configure-performance', '3-configure-profiling'],
+  'javascript-nextjs': [
+    '0-alert',
+    '1-install',
+    '2-configure-performance',
+    '3-configure-profiling',
+  ],
 };
 
 function makeDocKey(platformId: PlatformKey, key: string) {
+  if (platformId === 'javascript-nextjs') {
+    return `node-javascript-nextjs-profiling-onboarding-${key}`;
+  }
   return `${platformId}-profiling-onboarding-${key}`;
 }
 
@@ -48,6 +57,11 @@ export function makeDocKeyMap(platformId: PlatformKey | undefined) {
 
   const expectedDocKeys: ProfilingOnboardingDocKeys[] =
     supportedPlatformExpectedDocKeys[docsPlatform];
+
+  if (!expectedDocKeys) {
+    return null;
+  }
+
   return expectedDocKeys.reduce((acc: DocKeyMap, key) => {
     acc[key] = makeDocKey(docsPlatform, key);
     return acc;

+ 1 - 0
static/app/data/platformCategories.tsx

@@ -224,6 +224,7 @@ export const profiling = [
   'node-express',
   'node-koa',
   'node-connect',
+  'javascript-nextjs',
   // python, WSGI only
   'python',
   'python-django',

+ 5 - 0
static/app/utils/profiling/platforms.tsx

@@ -10,6 +10,7 @@ export const supportedProfilingPlatformSDKs = [
   'php',
   'rust',
   'php',
+  'javascript-nextjs',
 ] as const;
 export type SupportedProfilingPlatform = (typeof supportedProfilingPlatforms)[number];
 export type SupportedProfilingPlatformSDK =
@@ -34,6 +35,10 @@ export function getDocsPlatformSDKForPlatform(
     return 'node';
   }
 
+  if (platform === 'javascript-nextjs') {
+    return 'javascript-nextjs';
+  }
+
   if (platform.startsWith('python')) {
     return 'python';
   }