Skip to content

Commit 6034a4c

Browse files
committed
rm unused props
1 parent 1128c7d commit 6034a4c

File tree

3 files changed

+20
-47
lines changed

3 files changed

+20
-47
lines changed

static/app/views/settings/seer/seerAgentHooks.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,9 @@ describe('seerAgentHooks', () => {
7575

7676
describe('useSelectedAgentFromProjectSettings', () => {
7777
it('returns "none" when project autofixAutomationTuning is off', () => {
78-
const p = ProjectFixture({...project, autofixAutomationTuning: 'off'});
79-
8078
const {result} = renderHookWithProviders(useSelectedAgentFromProjectSettings, {
8179
initialProps: {
8280
preference: {repositories: []},
83-
project: p,
8481
integrations: [],
8582
},
8683
organization,
@@ -93,7 +90,6 @@ describe('seerAgentHooks', () => {
9390
const {result} = renderHookWithProviders(useSelectedAgentFromProjectSettings, {
9491
initialProps: {
9592
preference: {repositories: []},
96-
project,
9793
integrations: [],
9894
},
9995
organization,
@@ -117,7 +113,6 @@ describe('seerAgentHooks', () => {
117113
integration_id: 99,
118114
},
119115
},
120-
project,
121116
integrations,
122117
},
123118
organization,

static/app/views/settings/seer/seerAgentHooks.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,11 @@ export function useAgentOptions({
4545
export function useSelectedAgentFromProjectSettings({
4646
integrations,
4747
preference,
48-
project,
4948
}: {
5049
integrations: CodingAgentIntegration[];
5150
preference: ProjectSeerPreferences;
52-
project: Project;
5351
}) {
5452
return useMemo(() => {
55-
// If we have autofixAutomationTuning==OFF then 'none' is picked
56-
if (project.autofixAutomationTuning === 'off') {
57-
return 'none';
58-
}
5953
// If we have nothing in preferences, then we have Seer
6054
if (!preference?.automation_handoff?.integration_id) {
6155
return 'seer';
@@ -65,11 +59,7 @@ export function useSelectedAgentFromProjectSettings({
6559
integration =>
6660
integration.id === String(preference.automation_handoff?.integration_id)
6761
);
68-
}, [
69-
preference?.automation_handoff?.integration_id,
70-
project.autofixAutomationTuning,
71-
integrations,
72-
]);
62+
}, [preference.automation_handoff?.integration_id, integrations]);
7363
}
7464

7565
export function useSelectedAgentFromBulkSettings({

static/gsApp/views/seerAutomation/components/projectDetails/autofixAgent.tsx

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import {t, tct} from 'sentry/locale';
2020
import type {Project} from 'sentry/types/project';
2121
import {useQuery} from 'sentry/utils/queryClient';
2222
import {useOrganization} from 'sentry/utils/useOrganization';
23+
import {useFetchAgentOptions} from 'sentry/views/settings/seer/overview/utils/seerPreferredAgent';
2324
import {
24-
useAgentOptions,
2525
useMutateSelectedAgent,
2626
useSelectedAgentFromProjectSettings,
2727
} from 'sentry/views/settings/seer/seerAgentHooks';
@@ -39,14 +39,11 @@ function AgentSpecificFields({
3939
integration,
4040
...props
4141
}: Props & {
42-
integration: 'seer' | 'none' | CodingAgentIntegration;
42+
integration: 'seer' | CodingAgentIntegration;
4343
}) {
4444
if (integration === 'seer') {
4545
return <SeerAgentSettings {...props} />;
4646
}
47-
if (integration === 'none') {
48-
return null;
49-
}
5047
if (integration.provider === 'cursor' || integration.provider === 'claude_code') {
5148
return <CodingAgentSettings integration={integration} {...props} />;
5249
}
@@ -63,10 +60,9 @@ export function AutofixAgent({canWrite, preference, project}: Props) {
6360
...organizationIntegrationsCodingAgents(organization),
6461
select: data => data.json.integrations ?? [],
6562
});
66-
const options = useAgentOptions({integrations: integrations ?? []});
63+
const options = useFetchAgentOptions({organization});
6764
const selected = useSelectedAgentFromProjectSettings({
6865
preference,
69-
project,
7066
integrations: integrations ?? [],
7167
});
7268
const mutateSelectedAgent = useMutateSelectedAgent({project});
@@ -101,37 +97,29 @@ export function AutofixAgent({canWrite, preference, project}: Props) {
10197
),
10298
}
10399
)}
104-
options={options}
100+
options={options.data ?? []}
105101
value={selected}
106-
onChange={(integration: 'seer' | 'none' | CodingAgentIntegration) => {
102+
onChange={(integration: 'seer' | CodingAgentIntegration) => {
107103
mutateSelectedAgent(integration, {
108104
onSuccess: () =>
109105
addSuccessMessage(
110-
integration === 'none'
111-
? t('Removed coding agent')
112-
: tct('Started using [name] as coding agent', {
113-
name: (
114-
<strong>
115-
{integration === 'seer'
116-
? t('Seer Agent')
117-
: integration.name}
118-
</strong>
119-
),
120-
})
106+
tct('Started using [name] as coding agent', {
107+
name: (
108+
<strong>
109+
{integration === 'seer' ? t('Seer Agent') : integration.name}
110+
</strong>
111+
),
112+
})
121113
),
122114
onError: () =>
123115
addErrorMessage(
124-
integration === 'none'
125-
? t('Failed to update coding agent')
126-
: tct('Failed to set [name] as coding agent', {
127-
name: (
128-
<strong>
129-
{integration === 'seer'
130-
? t('Seer Agent')
131-
: integration.name}
132-
</strong>
133-
),
134-
})
116+
tct('Failed to set [name] as coding agent', {
117+
name: (
118+
<strong>
119+
{integration === 'seer' ? t('Seer Agent') : integration.name}
120+
</strong>
121+
),
122+
})
135123
),
136124
});
137125
}}

0 commit comments

Comments
 (0)