From 1ecaa89e96c3b472e1db6fec7c7d327ffe37df85 Mon Sep 17 00:00:00 2001 From: Shayna Chambless Date: Wed, 8 Oct 2025 15:32:44 -0700 Subject: [PATCH] delete old stuff --- .../groupingInfo/groupingInfoSection.spec.tsx | 68 +++---------------- .../groupingInfo/useEventGroupingInfo.tsx | 46 +++---------- 2 files changed, 16 insertions(+), 98 deletions(-) diff --git a/static/app/components/events/groupingInfo/groupingInfoSection.spec.tsx b/static/app/components/events/groupingInfo/groupingInfoSection.spec.tsx index 7f24fd75c6d2b8..932e79a1290719 100644 --- a/static/app/components/events/groupingInfo/groupingInfoSection.spec.tsx +++ b/static/app/components/events/groupingInfo/groupingInfoSection.spec.tsx @@ -27,48 +27,6 @@ describe('EventGroupingInfo', () => { beforeEach(() => { MockApiClient.clearMockResponses(); - groupingInfoRequest = MockApiClient.addMockResponse({ - url: `/projects/org-slug/project-slug/events/${event.id}/grouping-info/`, - body: { - app: { - contributes: true, - description: 'variant description', - hash: '123', - hashMismatch: false, - key: 'key', - type: EventGroupVariantType.CHECKSUM, - }, - }, - }); - }); - - it('fetches and renders grouping info for errors', async () => { - render(); - await userEvent.click( - screen.getByRole('button', {name: 'View Event Grouping Information Section'}) - ); - expect(await screen.findByText('variant description')).toBeInTheDocument(); - expect(screen.getByText('123')).toBeInTheDocument(); - }); - - it('gets performance grouping info from group/event data', async () => { - const perfEvent = EventFixture({ - type: 'transaction', - occurrence: {fingerprint: ['123'], evidenceData: {op: 'bad-op'}}, - }); - const perfGroup = GroupFixture({issueCategory: IssueCategory.PERFORMANCE}); - - render( - - ); - - expect(await screen.findByText('performance problem')).toBeInTheDocument(); - expect(screen.getByText('123')).toBeInTheDocument(); - // Should not make grouping-info request - expect(groupingInfoRequest).not.toHaveBeenCalled(); - }); - - it('works with new groupingInfo format', async () => { groupingInfoRequest = MockApiClient.addMockResponse({ url: `/projects/org-slug/project-slug/events/${event.id}/grouping-info/`, body: { @@ -85,28 +43,18 @@ describe('EventGroupingInfo', () => { }, }, }); - render(); + }); + it('fetches and renders grouping info for errors', async () => { + render(); + await userEvent.click( + screen.getByRole('button', {name: 'View Event Grouping Information Section'}) + ); expect(await screen.findByText('variant description')).toBeInTheDocument(); expect(screen.getByText('123')).toBeInTheDocument(); }); - it('gets performance new grouping info from group/event data', async () => { - groupingInfoRequest = MockApiClient.addMockResponse({ - url: `/projects/org-slug/project-slug/events/${event.id}/grouping-info/`, - body: { - grouping_config: null, - variants: { - app: { - contributes: true, - description: 'variant description', - hash: '123', - hashMismatch: false, - key: 'key', - type: EventGroupVariantType.CHECKSUM, - }, - }, - }, - }); + + it('gets performance grouping info from group/event data', async () => { const perfEvent = EventFixture({ type: 'transaction', occurrence: {fingerprint: ['123'], evidenceData: {op: 'bad-op'}}, diff --git a/static/app/components/events/groupingInfo/useEventGroupingInfo.tsx b/static/app/components/events/groupingInfo/useEventGroupingInfo.tsx index c7daffa6360cf4..4f3605415bb591 100644 --- a/static/app/components/events/groupingInfo/useEventGroupingInfo.tsx +++ b/static/app/components/events/groupingInfo/useEventGroupingInfo.tsx @@ -8,38 +8,11 @@ import type {Group} from 'sentry/types/group'; import {useApiQuery} from 'sentry/utils/queryClient'; import useOrganization from 'sentry/utils/useOrganization'; -type EventGroupingInfoResponseOld = Record; type EventGroupingInfoResponse = { grouping_config: string | null; variants: Record; }; -// temporary function to convert the old response structure to the new one -function eventGroupingInfoResponseOldToNew( - old: EventGroupingInfoResponseOld | null -): EventGroupingInfoResponse | null { - const grouping_config = old - ? ( - Object.values(old).find( - variant => 'config' in variant && variant.config?.id - ) as any - )?.config?.id - : null; - return old - ? { - grouping_config, - variants: old, - } - : null; -} - -// temporary function to check if the respinse is old type -function isOld( - data: EventGroupingInfoResponseOld | EventGroupingInfoResponse | null -): data is EventGroupingInfoResponseOld { - return data ? !('grouping_config' in data) : false; -} - function generatePerformanceGroupInfo({ event, group, @@ -94,21 +67,18 @@ export function useEventGroupingInfo({ const hasPerformanceGrouping = event.occurrence && event.type === 'transaction'; - const {data, isPending, isError, isSuccess} = useApiQuery< - EventGroupingInfoResponseOld | EventGroupingInfoResponse - >([`/projects/${organization.slug}/${projectSlug}/events/${event.id}/grouping-info/`], { - enabled: !hasPerformanceGrouping, - staleTime: Infinity, - }); + const {data, isPending, isError, isSuccess} = useApiQuery( + [`/projects/${organization.slug}/${projectSlug}/events/${event.id}/grouping-info/`], + { + enabled: !hasPerformanceGrouping, + staleTime: Infinity, + } + ); - const groupInfoRaw = hasPerformanceGrouping + const groupInfo = hasPerformanceGrouping ? generatePerformanceGroupInfo({group, event}) : (data ?? null); - const groupInfo = isOld(groupInfoRaw) - ? eventGroupingInfoResponseOldToNew(groupInfoRaw) - : groupInfoRaw; - return { groupInfo, isPending,