groupMergedTab.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import * as Layout from 'sentry/components/layouts/thirds';
  2. import LoadingError from 'sentry/components/loadingError';
  3. import LoadingIndicator from 'sentry/components/loadingIndicator';
  4. import type {Group} from 'sentry/types/group';
  5. import {useLocation} from 'sentry/utils/useLocation';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. import {useParams} from 'sentry/utils/useParams';
  8. import useProjectFromSlug from 'sentry/utils/useProjectFromSlug';
  9. import GroupEventDetails, {
  10. type GroupEventDetailsProps,
  11. } from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
  12. import GroupMergedView from 'sentry/views/issueDetails/groupMerged';
  13. import {useGroup} from 'sentry/views/issueDetails/useGroup';
  14. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  15. function GroupMergedTab(props: GroupEventDetailsProps) {
  16. const params = useParams<{groupId: Group['id']}>();
  17. const location = useLocation();
  18. const hasStreamlinedUI = useHasStreamlinedUI();
  19. const organization = useOrganization();
  20. const {
  21. data: group,
  22. isPending: isGroupPending,
  23. isError: isGroupError,
  24. refetch: refetchGroup,
  25. } = useGroup({groupId: params.groupId});
  26. const project = useProjectFromSlug({
  27. organization,
  28. projectSlug: group?.project.slug,
  29. });
  30. // TODO(streamline-ui): Point router to event details page since merged issues opens in a drawer.
  31. if (hasStreamlinedUI) {
  32. return <GroupEventDetails {...props} />;
  33. }
  34. if (isGroupPending || !project) {
  35. return <LoadingIndicator />;
  36. }
  37. if (isGroupError) {
  38. return <LoadingError onRetry={refetchGroup} />;
  39. }
  40. return (
  41. <Layout.Body>
  42. <Layout.Main fullWidth>
  43. <GroupMergedView project={project} groupId={params.groupId} location={location} />
  44. </Layout.Main>
  45. </Layout.Body>
  46. );
  47. }
  48. export default GroupMergedTab;