fix(connect): bound WalletConnect switch on connect - #605
Merged
Conversation
Deploying web-sdk-react-example with
|
| Latest commit: |
61ae42d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://32ad8e55.web-sdk-react-example.pages.dev |
| Branch Preview URL: | https://walletconnect-hang.web-sdk-react-example.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dca52ff698
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
tolgahan-arikan
previously approved these changes
Jun 26, 2026
matt416
force-pushed
the
walletconnect-hang
branch
from
June 26, 2026 14:09
dca52ff to
61ae42d
Compare
tolgahan-arikan
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fix WalletConnect connect flows that can hang when the connector tries to switch to the configured default chain during connect and the wallet never settles
switchChain.What Changed
chainIdis stripped before calling wagmi's base WalletConnectconnect, so wagmi cannot perform its own unbounded internalswitchChainbefore this wrapper's timeout applies.walletConnectconfig now acceptscustomStoragePrefixand passes it through to wagmi WalletConnect, so apps can opt into isolated WalletConnect storage when they run another WalletConnect core.customStoragePrefixis explicitly provided, so existing WalletConnect sessions are not migrated by default.Why
Some WalletConnect wallets, notably Safe/smart-contract wallet flows, cannot satisfy app-initiated chain switching and may leave the switch promise pending. Because the switch was part of connect, the app stayed on “Connecting…” indefinitely.
This upstreams the package-level behavior needed by the downstream wallet-kit workaround in 0xPolygon/apps-team-packages#66 and the Portal bug in 0xPolygon/portal#1213.
Links
Verification
pnpm install --frozen-lockfilepnpm --filter @0xsequence/hooks buildpnpm -C packages/connect buildpnpm -C packages/connect typecheckpnpm -C packages/connect testpnpm exec eslint -c eslint.config.mjs packages/connect/src/connectors/walletConnect/walletConnect.ts packages/connect/src/config/defaultConnectors.tspnpm exec prettier --check packages/connect/src/connectors/walletConnect/walletConnect.ts packages/connect/src/config/defaultConnectors.ts .changeset/walletconnect-connect-timeout.mdReviewer Focus
walletConnect.customStoragePrefix.Manual QA Suggested