index.tsx 769 B

1234567891011121314151617181920212223
  1. import {useEffect} from 'react';
  2. import {RouteComponentProps} from 'react-router';
  3. import {switchOrganization} from 'sentry/actionCreators/organizations';
  4. import OrganizationContextContainer from 'sentry/views/organizationContext';
  5. import Body from './body';
  6. type Props = RouteComponentProps<{orgId: string}, {}> &
  7. Partial<React.ComponentProps<typeof OrganizationContextContainer>>;
  8. function OrganizationDetails({children, ...props}: Props) {
  9. // Switch organizations when the orgId changes
  10. useEffect(() => void switchOrganization(), [props.params.orgId]);
  11. return (
  12. <OrganizationContextContainer includeSidebar useLastOrganization {...props}>
  13. <Body>{children}</Body>
  14. </OrganizationContextContainer>
  15. );
  16. }
  17. export default OrganizationDetails;