index.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 {params, 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. key={`${params.groupId}-envs:${selection.environments.join(',')}`}
  31. environments={selection.environments}
  32. organization={organization}
  33. projects={projects}
  34. {...props}
  35. />
  36. );
  37. }
  38. export default withPageFilters(IssueDetailsContainer);