Skip to content

Commit bc8540a

Browse files
fix(releases): Add missing builds mock and prevent tab flicker on refetch
Add MockApiClient response for /builds/ endpoint in release list tests. Use keepPreviousData to prevent the mobile builds tab from flickering when query keys change during filter updates.
1 parent 851925b commit bc8540a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

static/app/views/releases/list/index.spec.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ describe('ReleasesList', () => {
100100
method: 'POST',
101101
body: {attributes: {}},
102102
});
103+
MockApiClient.addMockResponse({
104+
url: `/organizations/${organization.slug}/builds/`,
105+
body: [],
106+
});
103107
});
104108

105109
afterEach(() => {

static/app/views/releases/list/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Fragment, useCallback, useEffect, useMemo} from 'react';
22
import {forceCheck} from 'react-lazyload';
33
import styled from '@emotion/styled';
4-
import {useQuery} from '@tanstack/react-query';
4+
import {keepPreviousData, useQuery} from '@tanstack/react-query';
55

66
import {FeatureBadge} from '@sentry/scraps/badge';
77
import {Flex, Stack} from '@sentry/scraps/layout';
@@ -251,6 +251,7 @@ export default function ReleasesList() {
251251
}),
252252
staleTime: 60_000,
253253
enabled: !!hasPreprodFeature,
254+
placeholderData: keepPreviousData,
254255
});
255256

256257
// When "All Projects" is selected (represented by [-1]), check all accessible projects

0 commit comments

Comments
 (0)