diff --git a/lib/shared/search-utils.js b/lib/shared/search-utils.js --- a/lib/shared/search-utils.js +++ b/lib/shared/search-utils.js @@ -26,7 +26,6 @@ } from '../selectors/chat-selectors.js'; import { useUserSearchIndex } from '../selectors/nav-selectors.js'; import { relationshipBlockedInEitherDirection } from '../shared/relationship-utils.js'; -import type { User } from '../types/identity-search/search-response-types.js'; import type { MessageInfo, RawMessageInfo } from '../types/message-types.js'; import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; @@ -378,15 +377,15 @@ }); function useSearchIdentityUsers( usernameInputText: string, -): $ReadOnlyArray { +): $ReadOnlyArray { const currentUserID = useSelector( state => state.currentUserInfo && state.currentUserInfo.id, ); const { sendPrefixQuery } = useIdentitySearch(); - const [searchResults, setSearchResults] = React.useState( - ([]: $ReadOnlyArray), - ); + const [searchResults, setSearchResults] = React.useState< + $ReadOnlyArray, + >([]); const forwardLookupSearchText = useForwardLookupSearchText(usernameInputText); @@ -400,9 +399,13 @@ const searchIdentityUsersPromise = (async () => { try { const result = await sendPrefixQuery(forwardLookupSearchText); - setSearchResults( - result.filter(({ userID }) => userID !== currentUserID), - ); + const userInfos = result.map(user => ({ + id: user.userID, + username: user.username, + avatar: null, + })); + + setSearchResults(userInfos.filter(({ id }) => id !== currentUserID)); } catch (err) { console.error(err); setSearchResults([]);