Skip to content

Commit 2c2b50d

Browse files
authored
feat(issues): Clean up empty state project lookup (#114652)
Reworks the issues empty state handler while cleaning up the slow project lookup path. removes a class component and speeds up the project query by passing collapse query parameters and moves it to react query.
1 parent b1f77e5 commit 2c2b50d

4 files changed

Lines changed: 175 additions & 185 deletions

File tree

static/app/views/issueList/groupListBody.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {LoadingStreamGroup, StreamGroup} from 'sentry/components/stream/group';
99
import {SupergroupRow} from 'sentry/components/stream/supergroups/supergroupRow';
1010
import {GroupStore} from 'sentry/stores/groupStore';
1111
import type {Group} from 'sentry/types/group';
12-
import {useApi} from 'sentry/utils/useApi';
1312
import {useMedia} from 'sentry/utils/useMedia';
1413
import {useOrganization} from 'sentry/utils/useOrganization';
1514
import {useSyncedLocalStorageState} from 'sentry/utils/useSyncedLocalStorageState';
@@ -95,7 +94,6 @@ export function GroupListBody({
9594
onActionTaken,
9695
supergroupLookup,
9796
}: GroupListBodyProps) {
98-
const api = useApi();
9997
const organization = useOrganization();
10098

10199
if (loading) {
@@ -114,7 +112,6 @@ export function GroupListBody({
114112
if (!groupIds.length) {
115113
return (
116114
<NoGroupsHandler
117-
api={api}
118115
organization={organization}
119116
query={query}
120117
selectedProjectIds={selectedProjectIds}

static/app/views/issueList/noGroupsHandler/index.spec.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import {OrganizationFixture} from 'sentry-fixture/organization';
2+
import {ProjectFixture} from 'sentry-fixture/project';
23

34
import {render, screen} from 'sentry-test/reactTestingLibrary';
45

56
import {NoGroupsHandler} from 'sentry/views/issueList/noGroupsHandler';
67

78
describe('NoGroupsHandler', () => {
89
const defaultProps = {
9-
api: new MockApiClient(),
1010
query: '',
1111
organization: OrganizationFixture(),
1212
groupIds: [],
13+
selectedProjectIds: [],
1314
};
1415

1516
it('displays default empty state when first event has been sent', async () => {
16-
MockApiClient.addMockResponse({
17+
const projectsMock = MockApiClient.addMockResponse({
1718
url: '/organizations/org-slug/projects/',
1819
body: [],
1920
});
@@ -25,6 +26,7 @@ describe('NoGroupsHandler', () => {
2526
render(<NoGroupsHandler {...defaultProps} />);
2627

2728
expect(await screen.findByText('No issues match your search')).toBeInTheDocument();
29+
expect(projectsMock).not.toHaveBeenCalled();
2830
});
2931

3032
it('displays default empty state when an error occurs', async () => {
@@ -43,6 +45,25 @@ describe('NoGroupsHandler', () => {
4345
});
4446

4547
it('displays waiting for events state when first event has not been sent', async () => {
48+
MockApiClient.addMockResponse({
49+
url: '/organizations/org-slug/projects/',
50+
body: [ProjectFixture()],
51+
});
52+
MockApiClient.addMockResponse({
53+
url: '/projects/org-slug/project-slug/issues/',
54+
body: [],
55+
});
56+
MockApiClient.addMockResponse({
57+
url: '/organizations/org-slug/sent-first-event/',
58+
body: {sentFirstEvent: false},
59+
});
60+
61+
render(<NoGroupsHandler {...defaultProps} />);
62+
63+
expect(await screen.findByText(/Waiting for events/i)).toBeInTheDocument();
64+
});
65+
66+
it('displays waiting for events state when no projects exist yet', async () => {
4667
MockApiClient.addMockResponse({
4768
url: '/organizations/org-slug/projects/',
4869
body: [],

0 commit comments

Comments
 (0)