From 41bc18f313d745c0dd91e1c00057aa01b94ae8c0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 4 Apr 2019 21:59:00 +0300 Subject: Fix avatar reload --- vnext/src/components/Avatar.js | 10 ++++++++-- vnext/src/components/Message.js | 2 +- vnext/src/components/UserInfo.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'vnext') 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 (
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 ? {user.uname} -- cgit v1.2.3