-
Notifications
You must be signed in to change notification settings - Fork 18
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
Cache selected active account in localStorage #15
Comments
Hey @VinGitonga, that's a great suggestion. Will have a look at it. I guess I, therefore, need to store the latest selected account in the localStorage and pre-select that on connect. Are there any edge cases or scenarios where this behavior wouldn't make sense? Wdyt? |
At the moment None. But the implementation would be great since. Currently am building a dapp that supports diffrent user accounts based on their wallet addresses and reconnecting to the right wallet all the time seems to much. |
I would add storing one more thing in localStorage Currently there is the The workaround I currently have is in my connect component useEffect(() => {
const userWantsConnection = ls.get("userWantsConnection");
if (userWantsConnection) {
connect?.();
}
}, []);
...
<Button
onClick={() => {
ls.set("userWantsConnection", true);
}}
>Connect</Button> where ls is just a localstorage helper. One solution would be, to add the above effect to the provider and run if |
ping |
I've noticed that when i reload a page with one connected wallet account, the active account switches to the first account if there more than one account or wallet addresses in the wallet.
Especially on page refresh
This is before page refresh
After page refresh
The text was updated successfully, but these errors were encountered: