Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add optional chaining to currencyRates check for stability #28753

Merged

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Nov 27, 2024

Description

#28750

Open in GitHub Codespaces

Related issues

Fixes: #28750

Manual testing steps

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

Screenshots/Recordings

Pre-merge author checklist

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.

Copy link
Contributor

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.

@gambinish gambinish marked this pull request as ready for review November 27, 2024 01:56
@gambinish gambinish requested a review from a team as a code owner November 27, 2024 01:56
@gambinish gambinish requested a review from salimtb November 27, 2024 01:56
@metamaskbot
Copy link
Collaborator

Builds ready [24c2ecd]
Page Load Metrics (1725 ± 98 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32021541662364175
domContentLoaded14712100168918689
load14982156172520598
domInteractive218341189
backgroundConnect5108362813
firstReactRender1674362311
getState56621199
initialActions00000
loadScripts10481583125415876
setupStore65714168
uiStartup16792349191820096
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 81 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

? currencyRates[networkConfigurationsByChainId[chainId].nativeCurrency]
.conversionRate
? currencyRates?.[networkConfigurationsByChainId[chainId]?.nativeCurrency]
?.conversionRate
: conversionRate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to repro the linked issue locally?
From the error linked in the issue i think this optional chaining makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to reproduce exactly, but I've definitely seen similar bugs from time to time related to currencyRates not yet resolving.

@salimtb
Copy link
Contributor

salimtb commented Nov 27, 2024

LGTM ✅ I couldn't reproduce the issue, but the safe accessor will help us prevent this error.

@gambinish gambinish added this pull request to the merge queue Nov 27, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 27, 2024
@gambinish gambinish added this pull request to the merge queue Nov 27, 2024
Merged via the queue into develop with commit 3fa28bf Nov 27, 2024
84 checks passed
@gambinish gambinish deleted the fix/issue-28750_currency-rates-token-fiat-amount-undefined branch November 27, 2024 22:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-assets
Projects
None yet
4 participants