Merge branch 'develop' into fix-location

This commit is contained in:
Gerrie van Wyk 2022-05-23 22:37:25 +02:00 committed by GitHub
commit 4c53579c4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,23 +20,17 @@ const MountEvents = ({ children, context, triggerEvent, triggerEventAsync }) =>
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
let mounted = true;
setLoading(true);
const mount = async () => {
try {
await triggerEvent();
if (mounted) {
triggerEventAsync();
setLoading(false);
}
triggerEventAsync();
setLoading(false);
} catch (err) {
setError(err);
}
};
mount(); // TODO: check only run once.
return () => {
mounted = false;
};
mount();
}, [context]);
if (error) throw error;