Skip to content

Commit 631bc6f

Browse files
committed
👔 Check if query is fetching using query key
1 parent b23f876 commit 631bc6f

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
@@ -6,15 +6,20 @@ import type {ComboBoxState} from '@react-stately/combobox';
66
import {promptsUpdate} from 'sentry/actionCreators/prompts';
77
import {FeatureBadge} from 'sentry/components/core/badge/featureBadge';
88
import InteractionStateLayer from 'sentry/components/core/interactionStateLayer';
9-
import {useOrganizationSeerSetup} from 'sentry/components/events/autofix/useOrganizationSeerSetup';
9+
import {makeOrganizationSeerSetupQueryKey} from 'sentry/components/events/autofix/useOrganizationSeerSetup';
1010
import ExternalLink from 'sentry/components/links/externalLink';
1111
import LoadingIndicator from 'sentry/components/loadingIndicator';
1212
import {useSearchQueryBuilder} from 'sentry/components/searchQueryBuilder/context';
1313
import {IconSeer} from 'sentry/icons';
1414
import {t, tct} from 'sentry/locale';
1515
import {space} from 'sentry/styles/space';
1616
import {trackAnalytics} from 'sentry/utils/analytics';
17-
import {useIsMutating, useMutation, useQueryClient} from 'sentry/utils/queryClient';
17+
import {
18+
useIsFetching,
19+
useIsMutating,
20+
useMutation,
21+
useQueryClient,
22+
} from 'sentry/utils/queryClient';
1823
import useApi from 'sentry/utils/useApi';
1924
import useOrganization from 'sentry/utils/useOrganization';
2025

@@ -149,7 +154,10 @@ export function AskSeer<T>({state}: {state: ComboBoxState<T>}) {
149154
mutationKey: [setupCheckQueryKey(organization.slug)],
150155
});
151156

152-
const {isPending: isPendingSetupCheck} = useOrganizationSeerSetup();
157+
const isPendingSetupCheck =
158+
useIsFetching({
159+
queryKey: [makeOrganizationSeerSetupQueryKey(organization.slug)],
160+
}) > 0;
153161

154162
if (isPendingSetupCheck || isMutating) {
155163
return (

0 commit comments

Comments
 (0)