Browse Source

ref(ui): Move Similar Item type, remove `[]` type (#38683)

Scott Cooper 2 years ago
parent
commit
4b8ba3cf84

+ 17 - 3
static/app/stores/groupingStore.tsx

@@ -26,15 +26,15 @@ type State = {
   // "Compare" button state
   enableFingerprintCompare: boolean;
   error: boolean;
-  filteredSimilarItems: [];
+  filteredSimilarItems: SimilarItem[];
   loading: boolean;
   mergeDisabled: boolean;
   mergeList: Array<string>;
   mergeState: Map<any, any>;
   // List of fingerprints that belong to issue
-  mergedItems: [];
+  mergedItems: Fingerprint[];
   mergedLinks: string;
-  similarItems: [];
+  similarItems: SimilarItem[];
   similarLinks: string;
   // Disabled state of "Unmerge" button in "Merged" tab (for Issues)
   unmergeDisabled: boolean;
@@ -81,6 +81,20 @@ export type Fingerprint = {
   state?: string;
 };
 
+export type SimilarItem = {
+  isBelowThreshold: boolean;
+  issue: Group;
+  aggregate?: {
+    exception: number;
+    message: number;
+  };
+  score?: Record<string, number | null>;
+  scoresByInterface?: {
+    exception: Array<[string, number | null]>;
+    message: Array<[string, any | null]>;
+  };
+};
+
 type ResponseProcessors = {
   merged: (item: ApiFingerprint[]) => Fingerprint[];
   similar: (data: [Group, ScoreMap]) => {

+ 3 - 6
static/app/views/organizationGroupDetails/groupSimilarIssues/similarStackTrace/index.tsx

@@ -11,16 +11,13 @@ 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 GroupingStore from 'sentry/stores/groupingStore';
+import GroupingStore, {SimilarItem} from 'sentry/stores/groupingStore';
 import space from 'sentry/styles/space';
 import {Project} from 'sentry/types';
 import {callIfFunction} from 'sentry/utils/callIfFunction';
 
 import List from './list';
 
-type ListProps = React.ComponentProps<typeof List>;
-
-type SimilarItems = ListProps['items'];
 type RouteParams = {
   groupId: string;
   orgId: string;
@@ -33,9 +30,9 @@ type Props = RouteComponentProps<RouteParams, {}> & {
 
 type State = {
   error: boolean;
-  filteredSimilarItems: SimilarItems;
+  filteredSimilarItems: SimilarItem[];
   loading: boolean;
-  similarItems: SimilarItems;
+  similarItems: SimilarItem[];
   similarLinks: string | null;
   v2: boolean;
 };

+ 2 - 15
static/app/views/organizationGroupDetails/groupSimilarIssues/similarStackTrace/list.tsx

@@ -7,26 +7,13 @@ import Pagination from 'sentry/components/pagination';
 import {Panel, PanelBody} from 'sentry/components/panels';
 import SimilarSpectrum from 'sentry/components/similarSpectrum';
 import {t} from 'sentry/locale';
+import type {SimilarItem} from 'sentry/stores/groupingStore';
 import space from 'sentry/styles/space';
-import {Group, Organization, Project} from 'sentry/types';
+import type {Organization, Project} from 'sentry/types';
 
 import Item from './item';
 import Toolbar from './toolbar';
 
-type SimilarItem = {
-  isBelowThreshold: boolean;
-  issue: Group;
-  aggregate?: {
-    exception: number;
-    message: number;
-  };
-  score?: Record<string, number | null>;
-  scoresByInterface?: {
-    exception: Array<[string, number | null]>;
-    message: Array<[string, any | null]>;
-  };
-};
-
 type DefaultProps = {
   filteredItems: Array<SimilarItem>;
 };