Skip to content

Commit e34be63

Browse files
committed
👔 Check if query is fetching using query key
1 parent 2df7807 commit e34be63

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

static/app/components/events/autofix/useOrganizationSeerSetup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface OrganizationSeerSetupResponse {
1717
};
1818
}
1919

20-
function makeOrganizationSeerSetupQueryKey(orgSlug: string): ApiQueryKey {
20+
export function makeOrganizationSeerSetupQueryKey(orgSlug: string): ApiQueryKey {
2121
return [`/organizations/${orgSlug}/seer/setup-check/`];
2222
}
2323

static/app/components/searchQueryBuilder/askSeer.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@ import type {ComboBoxState} from '@react-stately/combobox';
55

66
import {promptsUpdate} from 'sentry/actionCreators/prompts';
77
import InteractionStateLayer from 'sentry/components/core/interactionStateLayer';
8-
import {useOrganizationSeerSetup} from 'sentry/components/events/autofix/useOrganizationSeerSetup';
8+
import {makeOrganizationSeerSetupQueryKey} from 'sentry/components/events/autofix/useOrganizationSeerSetup';
99
import ExternalLink from 'sentry/components/links/externalLink';
1010
import LoadingIndicator from 'sentry/components/loadingIndicator';
1111
import {useSearchQueryBuilder} from 'sentry/components/searchQueryBuilder/context';
1212
import {IconSeer} from 'sentry/icons';
1313
import {t, tct} from 'sentry/locale';
1414
import {space} from 'sentry/styles/space';
1515
import {trackAnalytics} from 'sentry/utils/analytics';
16-
import {useIsMutating, useMutation, useQueryClient} from 'sentry/utils/queryClient';
16+
import {
17+
useIsFetching,
18+
useIsMutating,
19+
useMutation,
20+
useQueryClient,
21+
} from 'sentry/utils/queryClient';
1722
import useApi from 'sentry/utils/useApi';
1823
import useOrganization from 'sentry/utils/useOrganization';
1924

@@ -144,7 +149,10 @@ export function AskSeer<T>({state}: {state: ComboBoxState<T>}) {
144149
mutationKey: [setupCheckQueryKey(organization.slug)],
145150
});
146151

147-
const {isPending: isPendingSetupCheck} = useOrganizationSeerSetup();
152+
const isPendingSetupCheck =
153+
useIsFetching({
154+
queryKey: [makeOrganizationSeerSetupQueryKey(organization.slug)],
155+
}) > 0;
148156

149157
if (isPendingSetupCheck || isMutating) {
150158
return (

0 commit comments

Comments
 (0)