Page MenuHomePhabricator

D8087.diff
No OneTemporary

D8087.diff

diff --git a/native/avatars/user-avatar.react.js b/native/avatars/user-avatar.react.js
--- a/native/avatars/user-avatar.react.js
+++ b/native/avatars/user-avatar.react.js
@@ -18,14 +18,17 @@
function UserAvatar(props: Props): React.Node {
const { userID, userInfo: userInfoProp, size } = props;
- const currentUserInfo = useSelector(state => state.currentUserInfo);
- const userInfo = useSelector(state =>
- userID ? state.userStore.userInfos[userID] : userInfoProp,
- );
-
- const avatarUserInfo =
- userID === currentUserInfo?.id ? currentUserInfo : userInfo;
- const avatarInfo = getAvatarForUser(avatarUserInfo);
+ const userInfo = useSelector(state => {
+ if (!userID) {
+ return userInfoProp;
+ } else if (userID === state.currentUserInfo?.id) {
+ return state.currentUserInfo;
+ } else {
+ return state.userStore.userInfos[userID];
+ }
+ });
+
+ const avatarInfo = getAvatarForUser(userInfo);
const resolvedUserAvatar = useENSResolvedAvatar(avatarInfo, userInfo);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 9:10 AM (19 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574788
Default Alt Text
D8087.diff (1 KB)

Event Timeline