From 155701e27ca417b61207f2359b2519d018f0a49d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 30 Oct 2019 10:21:14 +0300 Subject: Fix UserInfo --- vnext/src/ui/UserInfo.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'vnext/src/ui') diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js index 29bf426f..fe9cee19 100644 --- a/vnext/src/ui/UserInfo.js +++ b/vnext/src/ui/UserInfo.js @@ -16,12 +16,10 @@ let isMounted; * @param {{user: string, onUpdate?: function, children?: Element}} props */ export default function UserInfo(props) { - /** @type {import('../api').User} user */ - const currentUser = { + const [user, setUser] = useState({ uname: props.user, uid: 0 - }; - const [user, setUser] = useState(currentUser); + }); const { onUpdate } = props; const userRef = useRef(user); useEffect(() => { @@ -37,7 +35,7 @@ export default function UserInfo(props) { return () => { isMounted = false; }; - }, [onUpdate]); + }, [onUpdate, props.user]); return ( <>