Skip to content

Commit 353bd9d

Browse files
authored
chore(runway): cherry-pick fix: cp-7.47.0 set destination chain ID when token switch button is clicked (#16072)
- fix: cp-7.47.0 set destination chain ID when token switch button is clicked (#16032) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Currently clicking the "switch" button when bridging will break the quotes. This fixes that by ensuring the destination chain ID is properly set. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this bridge 2. Get quote 3. Switch tokens 4. Get quote ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/322c17ed-6a13-4b67-bd31-d517f3495ab0 <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/f2968aab-ade1-4dbd-a0b2-cdadc4d588ab <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [6b2f8f1](6b2f8f1)
2 parents 116bcc9 + 01054ae commit 353bd9d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • app/components/UI/Bridge/hooks/useSwitchTokens

app/components/UI/Bridge/hooks/useSwitchTokens/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
setDestToken,
55
selectDestToken,
66
selectSourceToken,
7+
setSelectedDestChainId
78
} from '../../../../../core/redux/slices/bridge';
89
import { useNetworkInfo } from '../../../../../selectors/selectedNetworkController';
910
import { useSwitchNetworks } from '../../../../Views/NetworkSelector/useSwitchNetworks';
@@ -48,6 +49,8 @@ export const useSwitchTokens = () => {
4849
dispatch(setDestToken(sourceToken));
4950

5051
if (sourceToken.chainId !== destToken.chainId) {
52+
dispatch(setSelectedDestChainId(sourceToken.chainId));
53+
5154
if (isSolanaChainId(destToken.chainId)) {
5255
await onNonEvmNetworkChange(destToken.chainId as CaipChainId);
5356
} else {

0 commit comments

Comments
 (0)