Page MenuHomePhabricator

D6450.id21634.diff
No OneTemporary

D6450.id21634.diff

diff --git a/web/modals/threads/members/add-members-modal.react.js b/web/modals/threads/members/add-members-modal.react.js
--- a/web/modals/threads/members/add-members-modal.react.js
+++ b/web/modals/threads/members/add-members-modal.react.js
@@ -6,6 +6,7 @@
changeThreadSettingsActionTypes,
changeThreadSettings,
} from 'lib/actions/thread-actions';
+import { useENSNames } from 'lib/hooks/ens-cache';
import { threadInfoSelector } from 'lib/selectors/thread-selectors';
import {
userSearchIndexForPotentialMembers,
@@ -77,6 +78,7 @@
userSearchIndex,
],
);
+ const userSearchResultsWithENSNames = useENSNames(userSearchResults);
const onSwitchUser = React.useCallback(
userID =>
@@ -112,35 +114,39 @@
threadID,
]);
- const pendingUsersWithNames = React.useMemo(
+ const pendingUserInfos = React.useMemo(
() =>
Array.from(pendingUsersToAdd)
- .map(userID => [userID, otherUserInfos[userID].username])
- .sort((a, b) => a[1].localeCompare(b[1])),
+ .map(userID => ({
+ id: userID,
+ username: otherUserInfos[userID].username,
+ }))
+ .sort((a, b) => a.username.localeCompare(b.username)),
[otherUserInfos, pendingUsersToAdd],
);
+ const pendingUserInfosWithENSNames = useENSNames(pendingUserInfos);
const labelItems = React.useMemo(() => {
- if (!pendingUsersWithNames.length) {
+ if (!pendingUserInfosWithENSNames.length) {
return null;
}
return (
<div className={css.addMembersPendingList}>
- {pendingUsersWithNames.map(([userID, username]) => (
- <Label key={userID} onClose={() => onSwitchUser(userID)}>
- {username}
+ {pendingUserInfosWithENSNames.map(userInfo => (
+ <Label key={userInfo.id} onClose={() => onSwitchUser(userInfo.id)}>
+ {userInfo.username}
</Label>
))}
</div>
);
- }, [onSwitchUser, pendingUsersWithNames]);
+ }, [onSwitchUser, pendingUserInfosWithENSNames]);
return (
<div className={css.addMembersContent}>
{labelItems}
<div className={css.addMembersListContainer}>
<AddMembersListContent
- userListItems={userSearchResults}
+ userListItems={userSearchResultsWithENSNames}
switchUser={onSwitchUser}
pendingUsersToAdd={pendingUsersToAdd}
hasParentThread={!!threadInfo.parentThreadID}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 12:12 AM (17 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2564563
Default Alt Text
D6450.id21634.diff (2 KB)

Event Timeline