aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/UserInfo.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components/UserInfo.js')
-rw-r--r--vnext/src/components/UserInfo.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js
index c8565cbf..7d84488e 100644
--- a/vnext/src/components/UserInfo.js
+++ b/vnext/src/components/UserInfo.js
@@ -19,16 +19,18 @@ export default function UserInfo(props) {
const { onUpdate } = props;
useEffect(() => {
isMounted = true;
- info(user.uname).then(response => {
- if (isMounted) {
- setUser(response.data);
- onUpdate && onUpdate(response.data);
- }
- });
+ if (!user.avatar) {
+ info(user.uname).then(response => {
+ if (isMounted) {
+ setUser(response.data);
+ onUpdate && onUpdate(response.data);
+ }
+ });
+ }
return () => {
isMounted = false;
};
- }, [onUpdate, user.uname]);
+ }, [onUpdate, user, user.avatar]);
return (
<>
<div className="userinfo">
@@ -85,19 +87,18 @@ const UserSummary = React.memo(Summary);
export function UserLink(props) {
const [user, setUser] = useState(props.user);
useEffect(() => {
- setUser(props.user);
isMounted = true;
if (!user.uid && user.uri) {
fetchUserUri(user.uri).then(response => {
if (isMounted) {
- setUser({...response.data, uid: 66666666});
+ setUser({ ...response.data, uid: 66666666 });
}
});
}
return () => {
isMounted = false;
};
- }, [props.user]);
+ }, [user.uid, user.uri]);
return (
user.uid ?
<Link key={user.uid} to={`/${user.uname}/`} className="info-avatar"><img src={user.avatar} />{user.uname}</Link>