From bdd92438275867c9904cb8d1ec5e1f6c930f706b Mon Sep 17 00:00:00 2001 From: Nick Gambino <35090461+gambinish@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:54:55 -0800 Subject: [PATCH] fix: Token details should not display zero balance for tokens without marketData (#29299) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** On main asset list, if a token doesn't have marketData, we do not display the fiat value. On tokenDetails we were falling back to zero balance (this is incorrect) This PR adds a fix to not fallback to zero balance, and to instead simply omit the value. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29299?quickstart=1) ## **Related issues** Fixes: https://github.com/MetaMask/metamask-extension/issues/29244 ## **Manual testing steps** 1. Add a memcoin without marketData 2. Validate that no fiat value is shown on main asset list 3. Validate that no fiat value is shown on token details (should not display zero value) 4. Ensure nothing results in `NaN` value. ## **Screenshots/Recordings** ### **Before** ### **After** ## **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/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-extension/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. --- .../asset/components/__snapshots__/asset-page.test.tsx.snap | 4 +--- ui/pages/asset/components/asset-page.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/pages/asset/components/__snapshots__/asset-page.test.tsx.snap b/ui/pages/asset/components/__snapshots__/asset-page.test.tsx.snap index dc3cf4c408de..6a55226a42cb 100644 --- a/ui/pages/asset/components/__snapshots__/asset-page.test.tsx.snap +++ b/ui/pages/asset/components/__snapshots__/asset-page.test.tsx.snap @@ -223,9 +223,7 @@ exports[`AssetPage should render a native asset 1`] = `
- $0.00 -
+ />