diff options
Diffstat (limited to 'vnext/src/components')
-rw-r--r-- | vnext/src/components/Avatar.js | 10 | ||||
-rw-r--r-- | vnext/src/components/Message.js | 2 | ||||
-rw-r--r-- | vnext/src/components/UserInfo.js | 4 |
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> |