Uncaught (in promise) Error: Cannot execute Moralis.enableWeb3(), as Moralis Moralis.enableWeb3() already has been called, but is not finished yet.
I’ve been getting this error consistently, and I’m unsure of how to “wait” for it to be finished before executing the next function.
I’ve been looking through the documentation, but it isn’t providing me with much information. I presume that the above await Moralis.enableWeb3() has to be called before every async Moralis function, right? For example, executeFunction.
useEffect(() => {
// Run for the first time
fetchWhiteList().then(()=>{
console.log(“Mint status updated updated!”);
fetchTotalSupply().then(()=>{
console.log(“Total Supply updated!”);
});
})if (isLoading) { mint().then(() => { //fetchTotalSupply(); // fetchWhiteList(); fetchWhiteList().then(()=>{ console.log("Mint status updated!") fetchTotalSupply().then(()=>{ console.log("Total Supply updated!"); }); }); setCounter(0); setLoading(false); }); }
}, [isLoading]);
Above is the hook that is causing the error. Just for clarification, useEffect is only executed when the mint button is pressed.
In fetchWhitelist, fetchTotalSupply and mint functions, they all have an await Moralis.enableWeb3() before the executeFunction is called.