Skip to content

Commit

Permalink
fix: Add optional chaining to currencyRates check for stability (#28753)
Browse files Browse the repository at this point in the history
## **Description**

#28750

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28753?quickstart=1)

## **Related issues**

Fixes: #28750

## **Manual testing steps**

Testing steps in issue. Behavior is inconsistent, hard to replicate
consistently.

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.
  • Loading branch information
gambinish authored Nov 27, 2024
1 parent 6aeb777 commit 3fa28bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/hooks/useTokenFiatAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export function useTokenFiatAmount(
);

const tokenConversionRate = chainId
? currencyRates[networkConfigurationsByChainId[chainId].nativeCurrency]
.conversionRate
? currencyRates?.[networkConfigurationsByChainId[chainId]?.nativeCurrency]
?.conversionRate
: conversionRate;

const currentCurrency = useSelector(getCurrentCurrency);
Expand Down

0 comments on commit 3fa28bf

Please sign in to comment.