index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {useEffect} from 'react';
  2. import {RouteComponentProps} from 'react-router';
  3. import {fetchProjectDetails} from 'sentry/actionCreators/project';
  4. import {PageFilters} from 'sentry/types';
  5. import useApi from 'sentry/utils/useApi';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. import useProjects from 'sentry/utils/useProjects';
  8. import withPageFilters from 'sentry/utils/withPageFilters';
  9. import GroupDetails from './groupDetails';
  10. type Props = {
  11. children: React.ReactNode;
  12. isGlobalSelectionReady: boolean;
  13. selection: PageFilters;
  14. } & RouteComponentProps<{groupId: string}, {}>;
  15. function IssueDetailsContainer({selection, ...props}: Props) {
  16. const organization = useOrganization();
  17. const {projects} = useProjects();
  18. const api = useApi();
  19. const {location} = props;
  20. const projectId = location.query.project;
  21. const project = projects.find(proj => proj.id === projectId);
  22. useEffect(() => {
  23. if (!project?.slug) {
  24. return;
  25. }
  26. fetchProjectDetails({api, orgSlug: organization.slug, projSlug: project.slug});
  27. }, [api, organization.slug, project?.slug]);
  28. return (
  29. <GroupDetails
  30. environments={selection.environments}
  31. organization={organization}
  32. projects={projects}
  33. {...props}
  34. />
  35. );
  36. }
  37. export default withPageFilters(IssueDetailsContainer);