groupMergedTab.tsx 1.7 KB

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