mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-31 15:20:32 +08:00
Merge branch 'develop' into fix-location
This commit is contained in:
commit
4c53579c4b
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user