fix: reset confirm trade modal state when chain switches (#6667)
<!-- Your PR title must follow conventional commits: https://github.com/Uniswap/interface#pr-title --> ## Description <!-- Summary of change, including motivation and context. --> <!-- Use verb-driven language: "Fixes XYZ" instead of "This change fixes XYZ" --> Resets the swap component's local state when the chain changes, to fix Confirmation Modal behavior <!-- Delete inapplicable lines: --> _Linear ticket:_ https://linear.app/uniswap/issue/WEB-2161/wonky-swap-modal-behavior-after-switching-chains _Slack thread:_ https://uniswapteam.slack.com/archives/C047U65H422/p1685467094162069?thread_ts=1685459249.400839&cid=C047U65H422 <!-- Delete this section if your change does not affect UI. --> ## Screen capture ### Before https://github.com/Uniswap/interface/assets/66155195/115e243a-858b-490d-be9e-269174cc7561 ### After https://github.com/Uniswap/interface/assets/66155195/a47b3606-08ac-490f-abc8-01acf2423efb ## Test plan <!-- Delete this section if your change is not a bug fix. --> ### Reproducing the error <!-- Include steps to reproduce the bug. --> 1. swap on a l2 2. via the metamask extension (or in whatever wallet), trigger a chain-change event (e.g. from optimism to mainnet) a. this does not repro if you change chains from within the app selector. 4. fill in the input details for a new trade (ideally with different tokens so you can notice the bug easily) 5. see that the Confirm Swap modal opens automatically when it shouldn't, and it has the wrong trade details ### QA (ie manual testing) <!-- Include steps to test the change, ensuring no regression. --> - [x] same steps as above, ensuring the modal behaves correctly #### Devices <!-- If applicable, include different devices and screen sizes that may be affected, and how you've tested them. --> ### Automated testing <!-- If N/A, check and note so it is obvious to your reviewers and does not show up as an incomplete task. --> <!-- eg - [x] Unit test N/A --> - [ ] Unit test - [ ] Integration/E2E test
Showing
Please register or sign in to comment