fix: make WCv2 session restore sequential #27950
Conversation
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The change affects dApp connectivity via WalletConnect at startup. No dedicated E2E tests exist for WalletConnect session restoration flows in the test suite. The most relevant E2E tags are:
SmokeNetworkExpansion was considered but the changes don't specifically affect Solana/non-EVM flows. SmokeConfirmations was considered but the session restoration fix doesn't directly affect transaction confirmation flows. No performance tests are needed — the 200ms stagger delay is intentional and small, and the change doesn't affect UI rendering, data loading, or critical user flow performance metrics. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27950 +/- ##
==========================================
- Coverage 82.60% 82.60% -0.01%
==========================================
Files 4839 4839
Lines 124404 124418 +14
Branches 27725 27726 +1
==========================================
+ Hits 102762 102772 +10
- Misses 14578 14581 +3
- Partials 7064 7065 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



Description
Changes WCv2 session/connection restores to be sequential. Previously they were concurrent. The concurrency was problematic because it would cause a large spike in relay traffic for users with numerous WCv2 connections.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/WAPI-1357
Manual testing steps
SESSION_RESTORE_STAGGER_MSto be something larger like 10000SESSION_RESTORE_STAGGER_MSdelay before you see the approval appearWhy this way instead of using the js debugger? Unfortunately restarting the app causes the debugger to disconnect, and so it isn't a reliable way to probe startup based flows.
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes WCv2 startup session restoration from concurrent async updates to a serialized loop with an added delay, which can impact connection readiness timing and expose ordering/regression issues in session/account syncing.
Overview
WCv2 startup now restores existing WalletConnect sessions sequentially via a new
restoreSessions()flow, adding a small stagger (SESSION_RESTORE_STAGGER_MS) betweenupdateSessioncalls to avoid relay-traffic spikes.Initialization (
WC2Manager.init) now triggers this restore pass after constructing the manager, and tests were extended to assert serial execution, the per-session delay, and that sessions with internal/invalid URLs are skipped.Written by Cursor Bugbot for commit 2c7c339. This will update automatically on new commits. Configure here.