fix: wrap async func in useEffect

This commit is contained in:
Arthur E. Jones 2022-07-14 14:34:43 -05:00 committed by James Long
parent 3290e73978
commit 1a449ae0b8

View file

@ -476,14 +476,16 @@ function SettingsLink({ to, name, style, first, last }) {
function Version() { function Version() {
let [version, setVersion] = useState(''); let [version, setVersion] = useState('');
useEffect(async () => { useEffect(() => {
const { error, version } = await send('get-server-version'); (async () => {
const { error, version } = await send('get-server-version');
if (error) { if (error) {
setVersion(''); setVersion('');
} else { } else {
setVersion(version); setVersion(version);
} }
})();
}, []); }, []);
return ( return (