Feat/use wallet hook#2488
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| const syncAccountState = async (): Promise<void> => { | ||
| await Promise.all([getUserInfo(), syncWallets()]); | ||
| }; |
There was a problem hiding this comment.
Race condition in parallel syncAccountState calls
Low Severity
syncAccountState calls getUserInfo() and syncWallets() in parallel via Promise.all. Since syncWallets() internally calls the synchronous getConnectedAccountsWithProviders(), it reads the connector map state before getUserInfo() has a chance to call syncConnectedWalletLinkedAccounts. This means connectedWalletIds may contain stale IDs (e.g., "__primary__") that won't match real linked account IDs, causing getSwitchButtonText to show incorrect button text until a subsequent sync.
Reviewed by Cursor Bugbot for commit df609f4. Configure here.
…out wallet is connected
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1423d0. Configure here.


Jira Link
N/A
Description
This PR adds a new
useWalletshook for both React and Vue, backed bygetConnectedAccountsWithProviders(), and re-exports it from the modal packages for easier app integration.It also enriches connected wallet state with linked-account metadata so consumers can distinguish between linked wallets and currently connected wallets. Using that data, the demo account-linking screen now shows
Switch to this walletonly for already connected linked wallets and falls back toConnect this walletotherwise.In addition, this PR fixes reconnect behavior in the Wagmi and Solana providers so reconnect logic only runs for the primary connector during account switching, and replaces hardcoded account-linking status copy in the modal UI with translation keys.
How has this been tested?
npm run test@web3auth/modal:test@web3auth/no-modal:testScreenshots (if appropriate)
N/A
Types of changes
Checklist
Note
Medium Risk
Medium risk because it changes how
Web3AuthNoModaltracks connected wallet state during account switching and alters reconnect gating for Wagmi/Solana providers, which could affect session/connection synchronization across connectors.Overview
Adds a new
useWalletshook (React/Vue) that syncs currently connected accounts (including connector + provider details) viagetConnectedAccountsWithProviders(), and re-exports it from@web3auth/modalfor easier consumption.Refactors connected-wallet state in
Web3AuthNoModalto store linked-account metadata alongside providers/connectors, keep that metadata in sync when fetching user/linked accounts, and exposegetConnectedAccountsWithProviders()(with new tests).Behavior tweaks: Wagmi and Solana providers now only resync/reconnect when the active connection matches the primary connector during account switching, the demo account-linking view distinguishes connected vs merely linked wallets (button text + refresh), and account-linking status copy in the modal UI is moved to i18n keys (EN/FR).
Reviewed by Cursor Bugbot for commit 2d275b6. Bugbot is set up for automated code reviews on this repo. Configure here.