Browse Source

ref(ts): Fix subtle issue w/ organization-header hook (#62875)

Evan Purkhiser 1 year ago
parent
commit
10cdcc6d2a
2 changed files with 6 additions and 4 deletions
  1. 1 1
      static/app/types/hooks.tsx
  2. 5 3
      static/app/views/organizationContextContainer.tsx

+ 1 - 1
static/app/types/hooks.tsx

@@ -179,7 +179,7 @@ export type ComponentHooks = {
   'component:member-list-header': () => React.ComponentType<MemberListHeaderProps>;
   'component:monitor-status-toggle': () => React.ComponentType<StatusToggleButtonProps>;
   'component:org-stats-banner': () => React.ComponentType<DashboardHeadersProps>;
-  'component:organization-header': React.ComponentType<OrganizationHeaderProps>;
+  'component:organization-header': () => React.ComponentType<OrganizationHeaderProps>;
   'component:product-selection-availability': () => React.ComponentType<ProductSelectionAvailabilityProps>;
   'component:product-unavailable-cta': () => React.ComponentType<ProductUnavailableCTAProps>;
   'component:profiling-am1-or-mmx-upgrade': () => React.ComponentType<ProfilingAM1OrMMXUpgradeProps>;

+ 5 - 3
static/app/views/organizationContextContainer.tsx

@@ -307,12 +307,14 @@ class OrganizationContextContainer extends Component<Props, State> {
   }
 
   renderBody() {
+    const {organization} = this.state;
+
     return (
-      <SentryDocumentTitle noSuffix title={this.state.organization?.name ?? 'Sentry'}>
-        <OrganizationContext.Provider value={this.state.organization}>
+      <SentryDocumentTitle noSuffix title={organization?.name ?? 'Sentry'}>
+        <OrganizationContext.Provider value={organization}>
           <div className="app">
             {this.state.hooks}
-            <OrganizationHeader organization={this.state.organization} />
+            {organization && <OrganizationHeader organization={organization} />}
             {this.renderSidebar()}
             {this.props.children}
           </div>