From 5d4ff506a0d1ebebe92900985b7bce74501b658d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Feb 2019 15:38:10 +0300 Subject: Fix Avatar state update - https://stackoverflow.com/questions/54865764 --- vnext/src/components/Avatar.js | 3 ++- vnext/src/components/Types.js | 3 ++- vnext/src/components/UserInfo.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'vnext/src') diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js index 67d75c5e..64c16ead 100644 --- a/vnext/src/components/Avatar.js +++ b/vnext/src/components/Avatar.js @@ -15,6 +15,7 @@ let isMounted; function Avatar(props) { const [user, setUser] = useState(props.user); useEffect(() => { + setUser(props.user); isMounted = true; if (!user.uid && user.uri) { fetchUserUri(user.uri).then(response => { @@ -26,7 +27,7 @@ function Avatar(props) { isMounted = false; }; } - }); + }, [props.user]); return (