diff options
Diffstat (limited to 'vnext')
-rw-r--r-- | vnext/src/components/UserInfo.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js index d772d76e..b08355f8 100644 --- a/vnext/src/components/UserInfo.js +++ b/vnext/src/components/UserInfo.js @@ -12,13 +12,21 @@ import SearchBox from './SearchBox'; import './UserInfo.css'; +let isMounted; + export default function UserInfo(props) { const [user, setUser] = useState({ uname: props.user, uid: 0 }); useEffect(() => { + isMounted = true; info(user.uname).then(response => { - setUser(response.data); - props.onUpdate && props.onUpdate(response.data); + if (isMounted) { + setUser(response.data); + props.onUpdate && props.onUpdate(response.data); + } }); + return () => { + isMounted = false; + }; }); return ( <> |