aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-04-04 21:59:00 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:54 +0300
commit41bc18f313d745c0dd91e1c00057aa01b94ae8c0 (patch)
treea47c327072915344d884b2fdd5d4ed21ef1e5bd8 /vnext
parentaf69b9741e56141b6e17787a1b5373291016bd05 (diff)
Fix avatar reload
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/components/Avatar.js10
-rw-r--r--vnext/src/components/Message.js2
-rw-r--r--vnext/src/components/UserInfo.js4
3 files changed, 11 insertions, 5 deletions
diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js
index d4e83b7b..fed68ed1 100644
--- a/vnext/src/components/Avatar.js
+++ b/vnext/src/components/Avatar.js
@@ -17,11 +17,17 @@ function Avatar(props) {
useEffect(() => {
setUser(props.user);
isMounted = true;
-
+ if (!user.uid && !user.uname, user.uri) {
+ fetchUserUri(user.uri).then(response => {
+ if (isMounted) {
+ setUser(response.data);
+ }
+ });
+ }
return () => {
isMounted = false;
};
- }, [props.user, user.uid, user.uri]);
+ }, [props.user]);
return (
<div className="Avatar" style={props.style}>
<div className="msg-avatar">
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index f093221b..241aca07 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -133,7 +133,7 @@ Message.propTypes = {
MessageContainer.propTypes = {
isCode: PropTypes.bool.isRequired,
- data: PropTypes.array.isRequired
+ data: PropTypes.object.isRequired
};
Tags.propTypes = {
diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js
index 835bbace..a65bd993 100644
--- a/vnext/src/components/UserInfo.js
+++ b/vnext/src/components/UserInfo.js
@@ -71,7 +71,7 @@ export function UserLink(props) {
useEffect(() => {
setUser(props.user);
isMounted = true;
- if (!user.uid && user.uri) {
+ if (!user.uid && !user.uname && user.uri) {
fetchUserUri(user.uri).then(response => {
if (isMounted) {
setUser(response.data);
@@ -81,7 +81,7 @@ export function UserLink(props) {
return () => {
isMounted = false;
};
- }, [props.user, user.uid, user.uri]);
+ }, [props.user]);
return (
user.uid ?
<Link key={user.uid} to={`/${user.uname}/`} className="info-avatar"><img src={user.avatar}/>{user.uname}</Link>