aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
Diffstat (limited to 'vnext')
-rw-r--r--vnext/.eslintrc3
-rw-r--r--vnext/src/components/Avatar.js2
-rw-r--r--vnext/src/components/UserInfo.js7
3 files changed, 7 insertions, 5 deletions
diff --git a/vnext/.eslintrc b/vnext/.eslintrc
index f7aa66d1..6d200c92 100644
--- a/vnext/.eslintrc
+++ b/vnext/.eslintrc
@@ -63,6 +63,7 @@
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
- "react-hooks/rules-of-hooks": "error"
+ "react-hooks/rules-of-hooks": "error",
+ "react-hooks/exhaustive-deps": "warn"
}
}
diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js
index 64c16ead..dc2050ce 100644
--- a/vnext/src/components/Avatar.js
+++ b/vnext/src/components/Avatar.js
@@ -27,7 +27,7 @@ function Avatar(props) {
isMounted = false;
};
}
- }, [props.user]);
+ }, [props.user, user.uid, user.uri]);
return (
<div className="Avatar" style={props.style}>
<div className="msg-avatar">
diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js
index 0012d2a8..19b2f82b 100644
--- a/vnext/src/components/UserInfo.js
+++ b/vnext/src/components/UserInfo.js
@@ -16,18 +16,19 @@ let isMounted;
export default function UserInfo(props) {
const [user, setUser] = useState({ uname: props.user, uid: 0 });
+ const { onUpdate } = props;
useEffect(() => {
isMounted = true;
info(user.uname).then(response => {
if (isMounted) {
setUser(response.data);
- props.onUpdate && props.onUpdate(response.data);
+ onUpdate && onUpdate(response.data);
}
});
return () => {
isMounted = false;
};
- }, []);
+ }, [onUpdate, user.uname]);
return (
<>
<div className="userinfo">
@@ -80,7 +81,7 @@ export function UserLink(props) {
isMounted = false;
};
}
- }, [props.user]);
+ }, [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>