similarIssues.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import {Fragment} from 'react';
  2. import Feature from 'sentry/components/acl/feature';
  3. import LoadingError from 'sentry/components/loadingError';
  4. import LoadingIndicator from 'sentry/components/loadingIndicator';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. import {useParams} from 'sentry/utils/useParams';
  7. import useProjectFromSlug from 'sentry/utils/useProjectFromSlug';
  8. import {GroupRelatedIssues} from 'sentry/views/issueDetails/groupRelatedIssues';
  9. import {useGroup} from 'sentry/views/issueDetails/useGroup';
  10. import SimilarStackTrace from './similarStackTrace';
  11. function GroupSimilarIssues() {
  12. const params = useParams<{groupId: string}>();
  13. const organization = useOrganization();
  14. const {
  15. data: group,
  16. isPending: isGroupPending,
  17. isError: isGroupError,
  18. refetch: refetchGroup,
  19. } = useGroup({groupId: params.groupId});
  20. const project = useProjectFromSlug({
  21. organization,
  22. projectSlug: group?.project.slug,
  23. });
  24. if (isGroupPending || !project) {
  25. return <LoadingIndicator />;
  26. }
  27. if (isGroupError) {
  28. return <LoadingError onRetry={refetchGroup} />;
  29. }
  30. return (
  31. <Fragment>
  32. <Feature features="similarity-view" project={project}>
  33. <SimilarStackTrace project={project} />
  34. </Feature>
  35. <Feature features="related-issues">
  36. <GroupRelatedIssues />
  37. </Feature>
  38. </Fragment>
  39. );
  40. }
  41. export default GroupSimilarIssues;