-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix/solana disconnect #5374
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
base: main
Are you sure you want to change the base?
Fix/solana disconnect #5374
Conversation
…orId is not removed before calling ConnectorController.getConnectorId(ns)
|
|
@glitch-txs is attempting to deploy a commit to the Reown Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for your contribution! We ask that you please read and sign our CTA Document before we can accept your contribution. You can sign the CTA simply by posting a Pull Request Comment with the following text: I have read the CTA Document and I hereby sign the CTA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical bug in the Solana wallet disconnect flow by addressing two issues: 1) ensuring the connector ID is captured before being removed during disconnect, and 2) adding proper disconnect event emission when a Solana wallet disconnects externally.
- Reordered operations in
onDisconnectNamespaceto capture connector ID beforeresetAccountremoves it - Added disconnect event emission in
WalletStandardProviderwhen account becomes undefined - Added comprehensive tests to verify execution order and prevent regression
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/appkit/src/client/appkit-base-client.ts |
Reordered disconnect logic to call addDisconnectedConnectorId before resetAccount, fixing a bug where connector ID was undefined when needed |
packages/adapters/solana/src/providers/WalletStandardProvider.ts |
Added disconnect event emission when wallet change event has undefined account |
packages/appkit/tests/client/appkit-base-client.test.ts |
Added two comprehensive tests verifying execution order and connector ID handling during disconnect |
packages/adapters/solana/src/tests/WalletStandardProvider.test.ts |
Added test verifying disconnect event is emitted when account becomes undefined |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
disconnectevent emitter inWalletStandarProviderwhenaccountisundefined.addDisconnectedConnectorIdfunction up in theonDisconnectNamespacefunction from theAppKitBaseProvider.The second mentioned change was done to fix the following issue: when the wallet was manually disconnected (and so the
disconnectevent triggered), AppKit would triggerconnecton page load even though the wallet was previously disconnected.This was happening because
ConnectorController.removeConnectorIdwas being called fromresetAccountand so makingConnectorController.getConnectorIdundefined, thereforeStorageUtil.addDisconnectedConnectorIdwas failing to add the connector.Type of change
Associated Issues
For Linear issues: Closes APKT-xxx
For GH issues: closes #5365
Showcase (Optional)
If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.
Checklist