Browse Source

fix(growth): Create sample transaction in selected project (#27997)

Zhixing Zhang 3 years ago
parent
commit
54b0ccb72d
2 changed files with 14 additions and 2 deletions
  1. 1 0
      static/app/types/index.tsx
  2. 13 2
      static/app/views/performance/content.tsx

+ 1 - 0
static/app/types/index.tsx

@@ -636,6 +636,7 @@ export type RelativePeriod = keyof typeof DEFAULT_RELATIVE_PERIODS;
 export type IntervalPeriod = ReturnType<typeof getInterval>;
 export type IntervalPeriod = ReturnType<typeof getInterval>;
 
 
 export type GlobalSelection = {
 export type GlobalSelection = {
+  // Project Ids currently selected
   projects: number[];
   projects: number[];
   environments: string[];
   environments: string[];
   datetime: {
   datetime: {

+ 13 - 2
static/app/views/performance/content.tsx

@@ -202,7 +202,7 @@ class PerformanceContent extends Component<Props, State> {
   }
   }
 
 
   renderBody() {
   renderBody() {
-    const {organization, projects} = this.props;
+    const {organization, projects, selection} = this.props;
     const eventView = this.state.eventView;
     const eventView = this.state.eventView;
     const showOnboarding = this.shouldShowOnboarding();
     const showOnboarding = this.shouldShowOnboarding();
 
 
@@ -224,7 +224,18 @@ class PerformanceContent extends Component<Props, State> {
           <GlobalSdkUpdateAlert />
           <GlobalSdkUpdateAlert />
           {this.renderError()}
           {this.renderError()}
           {showOnboarding ? (
           {showOnboarding ? (
-            <Onboarding organization={organization} project={projects[0]} />
+            <Onboarding
+              organization={organization}
+              project={
+                selection.projects.length > 0
+                  ? // If some projects selected, use the first selection
+                    projects.find(
+                      project => selection.projects[0].toString() === project.id
+                    ) || projects[0]
+                  : // Otherwise, use the first project in the org
+                    projects[0]
+              }
+            />
           ) : (
           ) : (
             <LandingContent
             <LandingContent
               eventView={eventView}
               eventView={eventView}