Having a weird issue where 90% of users are fine authenticating using the code below, but it doesn’t work 1 in 10 tries (roughly, it is seemingly random so far, and i cannot pin down why – browsers and devices are more or less consistent. When it doesn’t work it adds the following a bunch of times into the Users table of Moralis’ backend (undefined many times over, one undefined row for each time a user tries to authenticate)…
Code being used for auth below:
const { isWeb3Enabled, enableWeb3, isAuthenticated, isWeb3EnableLoading } =
useMoralis();
useEffect(() => {
const connectorId = window.localStorage.getItem("connectorId");
if (!isAuthenticated && !isWeb3Enabled && !isWeb3EnableLoading) {
enableWeb3({ provider: connectorId });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isAuthenticated, isWeb3Enabled]);