-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On page load, not connected #82
Comments
connect("injected"); |
@supermars01 this doesn't seem to work for me, i call wallet.connect('injected') on my useEffect and the wallet account is null, but status is connected |
Yeah I get the same on hard reload. Account wont update // Check to see if we've set a provider in local Storage and connect
const initProvider = async () => {
if (provider) {
console.log('Provider Found:', provider)
await connect(provider)
registerProvider(ethereum)
}
}
// Once loaded, handoff provider & connect to wallet
useEffect(() => {
initProvider()
}, []) |
@Dellybro Okay found a hacky way to make it work. Watch for the |
The best way to do this is when the user first connects to a wallet, i.e. after you have called I'm using Gatsby so I'm overriding
|
I also encountered this problem. Can I only reconnect after each page refresh? |
I have same issue. |
Did you solve this problem? |
Ok, here's what worked for me. Only call In every other file, do something like this: const wallet = useWallet();
useEffect(() => {
if(wallet.status === 'connected') {
doStuff();
}
}, [wallet.status]); |
I can't seem to figure out how to keep a wallet connected on page refresh.
Thanks
The text was updated successfully, but these errors were encountered: