Closed aminlatifi closed 7 months ago
Any update?
cc @bfriel (I'll DM you to try to locate where this is happening)
@jordaaash @aminlatifi Will dive deeper into this but can't reproduce on any dapp I visit, including our sandbox: https://phantom-sandboxes.vercel.app/sol-adapter-sandbox, which uses the same useWallet
hook.
https://github.com/solana-labs/wallet-adapter/assets/23377962/7fc09428-6a74-4dcb-8a92-9902ff9469a0
@0xproflupin Is this its repo? https://github.com/phantom/sandbox/blob/main/src/App.tsx If yes, they haven't used hook and have handled events manually.
FWIW I can repro on https://soldons.vercel.app/ (and not on Phantom's sol-adapter-sandbox)
@aminlatifi can you share code that uses the useWallet
hook and shows this issue? I don't think https://github.com/dmdin/donation-platform uses it either since it's svelte?
@aminlatifi this is the repo: https://github.com/0xproflupin/phantom-sandboxes/blob/main/src/sandboxes/adapter-sandbox/App.tsx As Callum said, if you could share source for https://soldons.vercel.app/, that would be helpful
@aminlatifi this is the repo: https://github.com/0xproflupin/phantom-sandboxes/blob/main/src/sandboxes/adapter-sandbox/App.tsx As Callum said, if you could share source for https://soldons.vercel.app/, that would be helpful
It's soldons source code https://github.com/dmdin/donation-platform
We have used @solana/wallet-adapter-react, but it's repeatable on a project built with Sevelte
Could you share the code using @solana/wallet-adapter-react
? We can then try to debug it against the source code Anvit shared and try to figure out why it's not working/if there's a bug somewhere that needs fixing. Or we'll be able to figure out what in Anvit's code you can use to make it work.
I don't have any experience with Svelte or a working Svelte example to debug against, so I don't think we're going to get any further with the SolDons example currently.
FWIW as one other data point, I can repro with Solflare (but not Phantom) on https://phantom-sandboxes.vercel.app/sol-adapter-sandbox
Our own repo is this, https://github.com/giveth/giveth-dapps-v2/ But we have handled the phantom manually by extracting phantom provider and listening to appropriate events.
To be honest I think we're going to need a minimal app (eg a fork of Phantom's sol-adapter-sandbox) that shows this issue. There's nothing I can see in the Phantom sandbox code that seems to be working around an issue here.
Closing because we can't repro in our code. Check out the starter projects in this repo or https://github.com/solana-labs/dapp-scaffold to see correct config examples for Wallet Adapter.
A litle update. I ran into the same issue for phantom when running it in a nextjs app in dev mode using npm run dev
, using the wallet multi button the account wouldnt change when I changed my account in the phantom extension.
But when building the next app using npm run build
and then starting it using npm run start
it worked fine.
So I think its a problem with nextjs hot reloading, or hot reloading in general.
A litle update. I ran into the same issue for phantom when running it in a nextjs app in dev mode using
npm run dev
, using the wallet multi button the account wouldnt change when I changed my account in the phantom extension.But when building the next app using
npm run build
and then starting it usingnpm run start
it worked fine. So I think its a problem with nextjs hot reloading, or hot reloading in general.
I can confirm. I am having the same issue. Starting the built server seems to fix the problem. Dev won't change the wallet.
None of the values returned by the useWallet hook (e.g. publicKey, connecting, connected, ...) don't change when the user switches to another connected phantom account. The user needs to refresh the page to see updated values. Technically the hook state values don't change I guess.
It's reported here with a fancy video: https://github.com/Giveth/giveth-dapps-v2/issues/3400#issuecomment-1887383061
We have used
@solana/wallet-adapter-react
, but it's repeatable on a project built with Sevelte https://github.com/dmdin/donation-platform https://soldons.vercel.app/Expected behavior Update hook state values by changing the wallet.
Desktop (please complete the following information):
Additional context Similar to https://github.com/solana-labs/wallet-adapter/issues/747