Skip to content

ref(crons): Remove usage of useTeams in sentryMemberTeamSelectorField #68193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';
import {TeamFixture} from 'sentry-fixture/team';
import {UserFixture} from 'sentry-fixture/user';

Expand All @@ -16,7 +15,6 @@ describe('SentryMemberTeamSelectorField', () => {
const org = OrganizationFixture();
const mockUsers = [UserFixture()];
const mockTeams = [TeamFixture()];
const mockProjects = [ProjectFixture()];

beforeEach(() => {
MemberListStore.init();
Expand Down Expand Up @@ -46,7 +44,6 @@ describe('SentryMemberTeamSelectorField', () => {
label="Select Owner"
onChange={mock}
name="team-or-member"
projects={mockProjects}
/>
);

Expand All @@ -68,7 +65,6 @@ describe('SentryMemberTeamSelectorField', () => {
label="Select Owner"
onChange={mock}
name="team-or-member"
projects={mockProjects}
/>
);

Expand All @@ -90,7 +86,6 @@ describe('SentryMemberTeamSelectorField', () => {
label="Select Owner"
onChange={mock}
name="team-or-member"
projects={mockProjects}
multiple
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import {useContext, useEffect, useMemo} from 'react';

import Avatar from 'sentry/components/avatar';
import {t} from 'sentry/locale';
import type {Project} from 'sentry/types';
import {useMembers} from 'sentry/utils/useMembers';
import {useTeams} from 'sentry/utils/useTeams';
import {useTeamsById} from 'sentry/utils/useTeamsById';
import {useUserTeams} from 'sentry/utils/useUserTeams';

import FormContext from '../formContext';

Expand All @@ -16,7 +15,6 @@ import SelectField from './selectField';
// projects can be passed as a direct prop as well
export interface RenderFieldProps extends SelectFieldProps<any> {
avatarSize?: number;
projects?: Project[];
/**
* Use the slug as the select field value. Without setting this the numeric id
* of the project will be used.
Expand Down Expand Up @@ -72,12 +70,7 @@ function SentryMemberTeamSelectorField({
);
useTeamsById({ids: ensureTeamIds});

const {
teams,
fetching: fetchingTeams,
onSearch: onTeamSearch,
loadMore: loadMoreTeams,
} = useTeams({provideUserTeams: true});
const {teams, isLoading: loadingTeams} = useUserTeams();

const teamOptions = teams?.map(team => ({
value: `team:${team.id}`,
Expand All @@ -94,7 +87,6 @@ function SentryMemberTeamSelectorField({
useEffect(
() => {
loadMoreMembers();
loadMoreTeams();
},
// Only ensure things are loaded at mount
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand All @@ -107,9 +99,8 @@ function SentryMemberTeamSelectorField({
allowClear
onInputChange={value => {
onMemberSearch(value);
onTeamSearch(value);
}}
isLoading={fetchingMembers || fetchingTeams}
isLoading={fetchingMembers || loadingTeams}
options={[
{
label: t('Members'),
Expand Down
Loading