Page MenuHomePhabricator

D6449.diff
No OneTemporary

D6449.diff

diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js
--- a/web/chat/chat-thread-composer.react.js
+++ b/web/chat/chat-thread-composer.react.js
@@ -3,6 +3,7 @@
import * as React from 'react';
import { useDispatch } from 'react-redux';
+import { useENSNames } from 'lib/hooks/ens-cache';
import { userSearchIndexForPotentialMembers } from 'lib/selectors/user-selectors';
import { getPotentialMemberItems } from 'lib/shared/search-utils';
import { threadIsPending } from 'lib/shared/thread-utils';
@@ -51,6 +52,7 @@
),
[usernameInputText, otherUserInfos, userSearchIndex, userInfoInputIDs],
);
+ const userListItemsWithENSNames = useENSNames(userListItems);
const onSelectUserFromSearch = React.useCallback(
(id: string) => {
@@ -84,7 +86,7 @@
const userSearchResultList = React.useMemo(() => {
if (
- !userListItems.length ||
+ !userListItemsWithENSNames.length ||
(!usernameInputText && userInfoInputArray.length)
) {
return null;
@@ -92,7 +94,7 @@
return (
<ul className={css.searchResultsContainer}>
- {userListItems.map((userSearchResult: UserListItem) => (
+ {userListItemsWithENSNames.map((userSearchResult: UserListItem) => (
<li key={userSearchResult.id} className={css.searchResultsItem}>
<Button
variant="text"
@@ -109,7 +111,7 @@
}, [
onSelectUserFromSearch,
userInfoInputArray.length,
- userListItems,
+ userListItemsWithENSNames,
usernameInputText,
]);
@@ -134,11 +136,12 @@
hideSearch('reset-active-thread-if-pending');
}, [hideSearch]);
+ const userInfoInputArrayWithENSNames = useENSNames(userInfoInputArray);
const tagsList = React.useMemo(() => {
- if (!userInfoInputArray?.length) {
+ if (!userInfoInputArrayWithENSNames?.length) {
return null;
}
- const labels = userInfoInputArray.map(user => {
+ const labels = userInfoInputArrayWithENSNames.map(user => {
return (
<Label key={user.id} onClose={() => onRemoveUserFromSelected(user.id)}>
{user.username}
@@ -146,7 +149,7 @@
);
});
return <div className={css.userSelectedTags}>{labels}</div>;
- }, [userInfoInputArray, onRemoveUserFromSelected]);
+ }, [userInfoInputArrayWithENSNames, onRemoveUserFromSelected]);
React.useEffect(() => {
if (!inputState) {

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 10:37 AM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579362
Default Alt Text
D6449.diff (2 KB)

Event Timeline