Browse Source

feat(issues): Remove child props from attachments page (#80776)

Scott Cooper 3 months ago
parent
commit
d41a62ea18
1 changed files with 21 additions and 7 deletions
  1. 21 7
      static/app/views/issueDetails/groupEventAttachments/index.tsx

+ 21 - 7
static/app/views/issueDetails/groupEventAttachments/index.tsx

@@ -4,22 +4,36 @@ import styled from '@emotion/styled';
 import Feature from 'sentry/components/acl/feature';
 import FeatureDisabled from 'sentry/components/acl/featureDisabled';
 import * as Layout from 'sentry/components/layouts/thirds';
+import LoadingError from 'sentry/components/loadingError';
+import LoadingIndicator from 'sentry/components/loadingIndicator';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import type {Group} from 'sentry/types/group';
-import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
 import useOrganization from 'sentry/utils/useOrganization';
+import {useParams} from 'sentry/utils/useParams';
+import {useGroup} from 'sentry/views/issueDetails/useGroup';
 import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
 
 import GroupEventAttachments from './groupEventAttachments';
 
-type Props = RouteComponentProps<{groupId: string}, {}> & {
-  group: Group;
-};
-
-function GroupEventAttachmentsContainer({group}: Props) {
+function GroupEventAttachmentsContainer() {
   const organization = useOrganization();
   const hasStreamlinedUI = useHasStreamlinedUI();
+  const params = useParams();
+
+  const {
+    data: group,
+    isPending: isGroupPending,
+    isError: isGroupError,
+    refetch: refetchGroup,
+  } = useGroup({groupId: params.groupId});
+
+  if (isGroupPending) {
+    return <LoadingIndicator />;
+  }
+
+  if (isGroupError) {
+    return <LoadingError onRetry={refetchGroup} />;
+  }
 
   return (
     <Feature