fix: remove whole redux state pass through for bridge selectors#33529
Conversation
|
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These selectors are critical for determining wallet addresses in bridge/swap flows. The refactoring changes how memoization works and how account scopes are matched. While the test file adds comprehensive unit tests validating the new behavior, E2E tests should verify the actual swap/bridge flows still work correctly end-to-end. SmokeSwap is selected because the changed selectors directly power the bridge/swap quote request, confirmation, and submission flows. The changes are a refactoring (not new functionality), with unit tests added, so risk is medium rather than high. Performance Test Selection: |
|



Description
This PR removes whole Redux-state passthrough inputs from three Bridge account selectors. The selectors now compose granular token and account inputs, preventing result recomputation on unrelated dispatches while preserving selected account-group lookup, destination scope matching, and the existing
Set<AccountId>API.It also adds EVM and non-EVM value coverage plus recomputation and reference-stability tests.
Changelog
CHANGELOG entry: null
Related issues
Fixes: #31269
Manual testing steps
N/A — this is an internal selector memoization change with no UI behavior change.
Automated verification: run
yarn jest app/selectors/bridge.test.tsand confirm all 24 tests pass, including the unrelated-state recomputation and stable Set-reference cases.Screenshots/Recordings
Before
N/A — no UI changes.
After
N/A — no UI changes.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Destination account eligibility logic was rewritten (different data source and
anyScopesMatchvs per-scope queries); behavior should match but account picking for bridge is user-facing if wrong.Overview
Refactors three Bridge account selectors so they no longer depend on the entire
RootState, which was forcing recomputation on every unrelated dispatch.selectSourceWalletAddressandselectBatchSellSourceWalletAddressnow composeselectSourceToken/selectBatchSellSourceTokenswithselectSelectedInternalAccountByScopeinstead of calling scope lookup inside a(state) => stateinput.selectValidDestInternalAccountIdsdropscreateDeepEqualSelectorandselectInternalAccountsByScopein favor ofselectInternalAccountsByIdplusanyScopesMatchfor destination scope and EVM wildcard (eip155:0) filtering, while still returning aSet<AccountId>.Tests add shared bridge selector mock state, EVM/Solana coverage, and assertions that unrelated bridge fields (e.g.
sourceAmount) do not trigger recomputation or newSetreferences until the relevant token changes.Reviewed by Cursor Bugbot for commit f604031. Bugbot is set up for automated code reviews on this repo. Configure here.