Skip to content

Commit d5389f9

Browse files
committed
We should do the correct isAutofixEnabled check on the backend, not on the front. This will also mean that the other callsites are consistent
1 parent 1818fd7 commit d5389f9

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

static/gsApp/components/primaryNavSeerConfigReminder.tsx

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ import {LinkButton} from '@sentry/scraps/button';
44
import {Flex, Stack} from '@sentry/scraps/layout';
55
import {Heading, Text} from '@sentry/scraps/text';
66

7-
import {bulkAutofixAutomationSettingsInfiniteOptions} from 'sentry/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings';
87
import {IconSeer} from 'sentry/icons';
98
import {t} from 'sentry/locale';
109
import type {Integration} from 'sentry/types/integrations';
1110
import type {Organization} from 'sentry/types/organization';
1211
import {trackAnalytics} from 'sentry/utils/analytics';
13-
import {useFetchAllPages} from 'sentry/utils/api/apiFetch';
1412
import {getApiUrl} from 'sentry/utils/api/getApiUrl';
1513
import {getSeerOnboardingCheckQueryOptions} from 'sentry/utils/getSeerOnboardingCheckQueryOptions';
1614
import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser';
17-
import {useApiQuery, useInfiniteQuery, useQuery} from 'sentry/utils/queryClient';
15+
import {useApiQuery, useQuery} from 'sentry/utils/queryClient';
1816
import {useOrganization} from 'sentry/utils/useOrganization';
1917
import {
2018
PrimaryNavigation,
@@ -130,29 +128,16 @@ function useReminderCopywriting() {
130128

131129
const hasSeatBasedSeer = organization.features.includes('seat-based-seer-enabled');
132130

133-
const autofixResult = useInfiniteQuery({
134-
...bulkAutofixAutomationSettingsInfiniteOptions({
135-
organization,
136-
}),
137-
enabled: hasSeatBasedSeer,
138-
staleTime: 60_000,
139-
select: ({pages}) => pages.flatMap(page => page.json),
140-
});
141-
useFetchAllPages({result: autofixResult});
142-
143-
const {data: autofixSettings, isPending: isAutofixPending} = autofixResult;
144-
145131
const {
146-
isPending: isOnboardingPending,
147-
isError: isOnboardingError,
148-
data: onboardingData,
132+
isPending,
133+
isError,
134+
data: data,
149135
} = useQuery(getSeerOnboardingCheckQueryOptions({organization, staleTime: 60_000}));
150136

151-
if (!hasSeatBasedSeer || isOnboardingPending || isOnboardingError || isAutofixPending) {
137+
if (!hasSeatBasedSeer || isPending || isError) {
152138
return null;
153139
}
154-
const {hasSupportedScmIntegration, isCodeReviewEnabled} = onboardingData;
155-
const hasAutofix = autofixSettings?.some(s => s.reposCount > 0);
140+
const {hasSupportedScmIntegration, isAutofixEnabled, isCodeReviewEnabled} = data;
156141

157142
if (!hasSupportedScmIntegration) {
158143
return {
@@ -163,7 +148,7 @@ function useReminderCopywriting() {
163148
};
164149
}
165150

166-
if (!hasAutofix) {
151+
if (!isAutofixEnabled) {
167152
return {
168153
title: (
169154
<Flex align="center" gap="sm">

0 commit comments

Comments
 (0)