From ef8c38749216ba8eb5918e398d12f3e48663f56f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 3 Apr 2019 01:05:21 +0300 Subject: react-hooks/exhaustive-deps --- vnext/src/components/Avatar.js | 2 +- vnext/src/components/UserInfo.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'vnext/src/components') 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 (
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 ( <>
@@ -80,7 +81,7 @@ export function UserLink(props) { isMounted = false; }; } - }, [props.user]); + }, [props.user, user.uid, user.uri]); return ( user.uid ? {user.uname} -- cgit v1.2.3