index.tsx 1.0 KB

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