Просмотр исходного кода

ref(ts): Remove organization:header hook (#62910)

Follow up after https://github.com/getsentry/getsentry/pull/12543
Evan Purkhiser 1 год назад
Родитель
Сommit
6c672ee3a3
2 измененных файлов с 1 добавлено и 15 удалено
  1. 0 6
      static/app/types/hooks.tsx
  2. 1 9
      static/app/views/organizationContextContainer.tsx

+ 0 - 6
static/app/types/hooks.tsx

@@ -266,7 +266,6 @@ export type FeatureDisabledHooks = {
 export type InterfaceChromeHooks = {
   footer: GenericComponentHook;
   'help-modal:footer': HelpModalFooterHook;
-  'organization:header': OrganizationHeaderComponentHook;
   'sidebar:bottom-items': SidebarBottomItemsHook;
   'sidebar:help-menu': GenericOrganizationComponentHook;
   'sidebar:item-label': SidebarItemLabelHook;
@@ -349,11 +348,6 @@ type GenericOrganizationComponentHook = (opts: {
  */
 type GenericProjectComponentHook = (opts: {project: Project}) => React.ReactNode;
 
-// TODO(ts): We should correct the organization header hook to conform to the
-// GenericOrganizationComponentHook, passing org as a prop object, not direct
-// as the only argument.
-type OrganizationHeaderComponentHook = (org: Organization) => React.ReactNode;
-
 /**
  * A FeatureDisabledHook returns a react element when a feature is not enabled.
  */

+ 1 - 9
static/app/views/organizationContextContainer.tsx

@@ -16,7 +16,6 @@ import {ORGANIZATION_FETCH_ERROR_TYPES} from 'sentry/constants';
 import {t} from 'sentry/locale';
 import SentryTypes from 'sentry/sentryTypes';
 import ConfigStore from 'sentry/stores/configStore';
-import HookStore from 'sentry/stores/hookStore';
 import OrganizationStore from 'sentry/stores/organizationStore';
 import {space} from 'sentry/styles/space';
 import {Organization} from 'sentry/types';
@@ -50,7 +49,6 @@ type State = {
   dirty?: boolean;
   error?: RequestError | null;
   errorType?: string | null;
-  hooks?: React.ReactNode[];
 };
 
 const OrganizationHeader = HookOrDefault({
@@ -229,13 +227,8 @@ class OrganizationContextContainer extends Component<Props, State> {
 
   loadOrganization(orgData: State) {
     const {organization, error} = orgData;
-    const hooks: React.ReactNode[] = [];
 
     if (organization && !error) {
-      HookStore.get('organization:header').forEach(cb => {
-        hooks.push(cb(organization));
-      });
-
       // Configure scope to have organization tag
       Sentry.configureScope(scope => {
         // XXX(dcramer): this is duplicated in sdk.py on the backend
@@ -260,7 +253,7 @@ class OrganizationContextContainer extends Component<Props, State> {
       }
     }
 
-    this.setState({...orgData, hooks}, () => {
+    this.setState({...orgData}, () => {
       // Take a measurement for when organization details are done loading and the new state is applied
       if (organization) {
         metric.measure({
@@ -313,7 +306,6 @@ class OrganizationContextContainer extends Component<Props, State> {
       <SentryDocumentTitle noSuffix title={organization?.name ?? 'Sentry'}>
         <OrganizationContext.Provider value={organization}>
           <div className="app">
-            {this.state.hooks}
             {organization && <OrganizationHeader organization={organization} />}
             {this.renderSidebar()}
             {this.props.children}