diff --git a/x-pack/plugins/cases/public/components/case_view/components/case_view_activity.tsx b/x-pack/plugins/cases/public/components/case_view/components/case_view_activity.tsx index 07cf815555f61..b5e1c21206203 100644 --- a/x-pack/plugins/cases/public/components/case_view/components/case_view_activity.tsx +++ b/x-pack/plugins/cases/public/components/case_view/components/case_view_activity.tsx @@ -61,11 +61,11 @@ export const CaseViewActivity = ({ const userActionProfileUids = Array.from(userActionsData?.profileUids.values() ?? []); const uidsToRetrieve = uniq([...userActionProfileUids, ...assignees]); - const { data: userProfiles, isLoading: isLoadingUserProfiles } = useBulkGetUserProfiles({ + const { data: userProfiles, isFetching: isLoadingUserProfiles } = useBulkGetUserProfiles({ uids: uidsToRetrieve, }); - const { data: currentUserProfile, isLoading: isLoadingCurrentUserProfile } = + const { data: currentUserProfile, isFetching: isLoadingCurrentUserProfile } = useGetCurrentUserProfile(); const onShowAlertDetails = useCallback( diff --git a/x-pack/plugins/cases/public/components/case_view/components/suggest_users_popover.tsx b/x-pack/plugins/cases/public/components/case_view/components/suggest_users_popover.tsx index cc20f2e4a54e0..de7de0ffbf2c7 100644 --- a/x-pack/plugins/cases/public/components/case_view/components/suggest_users_popover.tsx +++ b/x-pack/plugins/cases/public/components/case_view/components/suggest_users_popover.tsx @@ -137,7 +137,7 @@ const SuggestUsersPopoverComponent: React.FC = ({ [] ); - const { data: userProfiles, isLoading: isLoadingSuggest } = useSuggestUserProfiles({ + const { data: userProfiles, isFetching: isLoadingSuggest } = useSuggestUserProfiles({ name: searchTerm, owners: owner, }); @@ -173,7 +173,7 @@ const SuggestUsersPopoverComponent: React.FC = ({ searchPlaceholder: i18n.SEARCH_USERS, clearButtonLabel: i18n.REMOVE_ASSIGNEES, emptyMessage: , - noMatchesMessage: , + noMatchesMessage: searchResultProfiles ? : , }} /> ); @@ -183,7 +183,7 @@ SuggestUsersPopoverComponent.displayName = 'SuggestUsersPopover'; export const SuggestUsersPopover = React.memo(SuggestUsersPopoverComponent); -const sortProfiles = (profiles?: UserProfileWithAvatar[]) => { +const sortProfiles = (profiles?: UserProfileWithAvatar[] | null) => { if (!profiles) { return; } diff --git a/x-pack/plugins/cases/public/components/user_profiles/display_name.ts b/x-pack/plugins/cases/public/components/user_profiles/display_name.ts index 180e3f13b76c9..4abd9f276abaa 100644 --- a/x-pack/plugins/cases/public/components/user_profiles/display_name.ts +++ b/x-pack/plugins/cases/public/components/user_profiles/display_name.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { getUserDisplayName } from '@kbn/security-plugin/common'; -import { UserProfileUserInfo } from '@kbn/user-profile-components/target_types/user_profile'; +import { getUserDisplayName, UserProfileUserInfo } from '@kbn/user-profile-components'; import { isEmpty } from 'lodash'; import * as i18n from './translations'; diff --git a/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts index 8e50dd0be114c..c311eb5a55d1f 100644 --- a/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts +++ b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts @@ -31,7 +31,7 @@ export const useSuggestUserProfiles = ({ const toasts = useToasts(); - return useQuery( + return useQuery( [ USER_PROFILES_CACHE_KEY, USER_PROFILES_SUGGEST_CACHE_KEY, @@ -39,8 +39,9 @@ export const useSuggestUserProfiles = ({ ], () => { if (isEmpty(name)) { - return []; + return null; } + const abortCtrlRef = new AbortController(); return suggestUserProfiles({ http, @@ -67,4 +68,4 @@ export const useSuggestUserProfiles = ({ ); }; -export type UseSuggestUserProfiles = UseQueryResult; +export type UseSuggestUserProfiles = UseQueryResult;