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() {
let [version, setVersion] = useState('');
useEffect(async () => {
const { error, version } = await send('get-server-version');
useEffect(() => {
(async () => {
const { error, version } = await send('get-server-version');
if (error) {
setVersion('');
} else {
setVersion(version);
}
if (error) {
setVersion('');
} else {
setVersion(version);
}
})();
}, []);
return (