fix: prevent WalletConnect session proposal race conditions (WAPI-1070)#26121
Open
chakra-guy wants to merge 1 commit intoad/in-app-qr-code-universal-link-ios-bugfrom
Open
fix: prevent WalletConnect session proposal race conditions (WAPI-1070)#26121chakra-guy wants to merge 1 commit intoad/in-app-qr-code-universal-link-ios-bugfrom
chakra-guy wants to merge 1 commit intoad/in-app-qr-code-universal-link-ios-bugfrom
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: ad/in-app-qr-code-universal-link-ios-bug) All E2E tests pre-selected. |
|
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.



Description
Fixes a set of race conditions in the WalletConnect v2 connection flow that caused a "stuck" or looping connection tray when scanning QR codes. The root cause was multiple layers of concurrent/duplicate processing:
The OS can deliver the same deeplink 3-5 times via Linking + Branch. Each delivery called
pair()and pushed a loading modal, stacking duplicate modals on screen.The WalletConnect relay can fire the same
session_proposalevent multiple times when duplicatepair()calls were made, causing duplicate AccountConnect screens.Rapid QR scans caused overlapping proposals to fight over shared state (
wc2Metadata, navigation, approval queue).Changes to the
pendingApprovalsRedux state re-triggeredPermissionApproval'suseEffect, causing repeated navigation to AccountConnect for the same approval.Each issue is fixed at the layer where it occurs:
connect()seenTopics+ 5 s TTLonSessionProposal()proposalLock_handleSessionProposal()handledProposalIdsPermissionApprovallastNavigatedApprovalIdRefAdditionally fixes the
SDKLoadingLottie animation not being visible.Compatibility with #24040: The
PermissionApprovalchange keepspendingApprovalsin theuseEffectdeps (so the effect still re-runs when the queue changes, preventing stuck approvals). The added ref guard only skips navigation for the same approval ID; new approvals with a different ID navigate normally.Changelog
CHANGELOG entry: Fixed WalletConnect connection tray getting stuck or looping when scanning QR codes, and fixed the loading animation not displaying during connection.
Related issues
Fixes: WAPI-1070
Manual testing steps
Screenshots/Recordings
Screen.Recording.2026-02-16.at.14.16.502.mov
Pre-merge author checklist
Note
Medium Risk
Touches WalletConnect connection/proposal handling and approval navigation, where subtle timing/dedup logic could cause missed or delayed connection prompts. Changes are scoped with guards/timeouts and include a targeted test update.
Overview
Fixes WalletConnect v2 QR/deeplink connection loops by deduplicating and serializing key parts of the flow:
WC2Manager.connect()ignores duplicate pairing topics for a short TTL,onSessionProposal()now runs behind a serialized lock with a safety timeout, and_handleSessionProposal()ignores duplicate proposal IDs and clears stalewc2Metadataon rejection.Prevents
PermissionApprovalfrom re-navigating to AccountConnect whenpendingApprovalschanges but the current approval ID is unchanged (covered by an updated test), and fixes the SDK loading tray animation sizing by adding an explicitaspectRatiobased on the Lottie asset’s intrinsic dimensions. Minor logging cleanup in legacy deeplink handlers.Written by Cursor Bugbot for commit e71ce4b. This will update automatically on new commits. Configure here.