diff --git a/pages/accountLists/[accountListId]/settings/organizations/accountLists.page.tsx b/pages/accountLists/[accountListId]/settings/organizations/accountLists.page.tsx index c28850e49..0a7d23db3 100644 --- a/pages/accountLists/[accountListId]/settings/organizations/accountLists.page.tsx +++ b/pages/accountLists/[accountListId]/settings/organizations/accountLists.page.tsx @@ -64,26 +64,24 @@ const AccountListsOrganizations = (): ReactElement => { {organizations?.length && ( - {selectedOrganization && ( - setSearch(e.target.value)} - fullWidth - multiline - inputProps={{ 'aria-label': 'Search Account Lists' }} - style={{ - width: matches ? '150px' : '250px', - }} - InputProps={{ - startAdornment: ( - - - - ), - }} - /> - )} + setSearch(e.target.value)} + fullWidth + multiline + inputProps={{ 'aria-label': 'Search Account Lists' }} + style={{ + width: matches ? '150px' : '250px', + }} + InputProps={{ + startAdornment: ( + + + + ), + }} + /> { return dataSources.mpdxRestApi.searchOrganizationsAccountLists( - organizationId, search, pageNumber || 1, + organizationId || '', ); }, }, diff --git a/pages/api/graphql-rest.page.ts b/pages/api/graphql-rest.page.ts index eade72c14..75854e4ca 100644 --- a/pages/api/graphql-rest.page.ts +++ b/pages/api/graphql-rest.page.ts @@ -1221,18 +1221,19 @@ class MpdxRestApi extends RESTDataSource { // async searchOrganizationsAccountLists( - organizationId: string, search: string, pageNumber = 1, + organizationId?: string, ) { const include = 'account_list_users,account_list_coaches,account_list_users.user_email_addresses,' + 'account_list_coaches.coach_email_addresses,designation_accounts,' + 'designation_accounts.organization,account_list_invites,' + 'account_list_invites.invited_by_user'; - const filters = - `filter[organization_id]=${organizationId}` + - `&filter[wildcard_search]=${search}`; + const organizationIdFilter = organizationId + ? `&filter[organization_id]=${organizationId}` + : ''; + const filters = `filter[wildcard_search]=${search}` + organizationIdFilter; const fields = 'fields[account_lists]=name,account_list_coaches,account_list_users,account_list_invites,designation_accounts' + '&fields[account_list_coaches]=coach_first_name,coach_last_name,coach_email_addresses' + diff --git a/src/components/Settings/Organization/AccountLists/AccountLists.tsx b/src/components/Settings/Organization/AccountLists/AccountLists.tsx index 1c8d4f545..bdf7fff89 100644 --- a/src/components/Settings/Organization/AccountLists/AccountLists.tsx +++ b/src/components/Settings/Organization/AccountLists/AccountLists.tsx @@ -30,7 +30,7 @@ export const AccountLists: React.FC = () => { search: search, }, }, - skip: !selectedOrganizationId, + skip: !selectedOrganizationId && !search, }); const accountLists = data?.searchOrganizationsAccountLists.accountLists;