refactor: dedupe swaps quote data validation calls#29626
refactor: dedupe swaps quote data validation calls#29626infiniteflower wants to merge 3 commits intomainfrom
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 b1ee556. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes directly affect the Bridge/Swap user flow including quote fetching, confirmation buttons, and security validation. SmokeSwap covers bridge/swap flows, and per the tag description, SmokeConfirmations should also be selected when SmokeSwap is selected since transaction confirmations are part of the flow. No other feature areas (accounts, networks, identity, snaps, browser, etc.) are affected. Performance Test Selection: |
|




Description
This PR reduces duplicate Bridge quote data work in the main Bridge/Unified Swaps screen. Previously, multiple components in the
BridgeViewsubtree calleduseBridgeQuoteDataindependently, which could trigger repeated Blockaid validation for the same active quote.The main
BridgeViewsubtree now shares a single quote-data result throughBridgeQuoteDataProvider.useBridgeConfirmaccepts the caller'sactiveQuote, modal route roots keep their local quote data, and validation is guarded by quoterequestIdplus validation callback identity so the same quote/account context is not validated repeatedly.Changelog
CHANGELOG entry: null
Related issues
No issue: maintenance-only Bridge performance/refactor to reduce duplicate quote validation calls.
Manual testing steps
Screenshots/Recordings
Before
Screen.Recording.2026-04-30.at.5.08.56.PM.mov
After
Screen.Recording.2026-04-30.at.5.30.30.PM.mov
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
Touches core Bridge/Swaps quoting and confirmation flow by centralizing
useBridgeQuoteDataand changinguseBridgeConfirmto consume a passed-inactiveQuote, which could affect when quotes/validations run and what gets submitted. Risk is mitigated by added unit tests around context usage and validation retry behavior.Overview
Reduces duplicate quote-data work in the main
BridgeViewsubtree by introducingBridgeQuoteDataProvider/useBridgeQuoteDataContextand switching key consumers (footer, quote details, confirm button) to read a single shareduseBridgeQuoteDataresult.Updates quote validation to skip repeated Blockaid validations for the same quote by caching the last validated
requestId+validateBridgeTxfunction identity, while still retrying after a thrown validation error.Refactors
useBridgeConfirmto no longer fetch quote data internally; callers now passactiveQuote(modals fetch their own quote as needed). Includes test updates/new tests to reflect the context provider and new confirm/validation wiring.Reviewed by Cursor Bugbot for commit dda75d8. Bugbot is set up for automated code reviews on this repo. Configure here.