anza-xyz / wallet-adapter

Modular TypeScript wallet adapters and components for Solana applications.
https://anza-xyz.github.io/wallet-adapter/
Apache License 2.0
1.44k stars 905 forks source link

localstorage sometimes behaves strangely #977

Open lucian55 opened 1 month ago

lucian55 commented 1 month ago

When I use Phantom to connect to my wallet, the walletName in localstorage is set to "Phantom", which is normal. When I refresh the page, "Phantom" sometimes becomes "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"Phantom\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\"\""

It happens occasionally, not necessarily. What's going on?

lucian55 commented 1 month ago

I know the reason. For the same website, open two tabs, one using Phantom and the other disabling Phantom. Refreshing the disabled tab will cause the value of localstorage to be reset to "\"Phantom\""

mcintyre94 commented 21 hours ago

@lucian55 Could you give more information on how to reproduce this? If you can give step-by-step instructions using https://anza-xyz.github.io/wallet-adapter/example/ that'd be great!