Skip to content

fix: show correct decimal places when managing price alerts#31986

Merged
juanmigdr merged 1 commit into
mainfrom
fix/show-correct-decimal-places-manage-price-alerts
Jun 19, 2026
Merged

fix: show correct decimal places when managing price alerts#31986
juanmigdr merged 1 commit into
mainfrom
fix/show-correct-decimal-places-manage-price-alerts

Conversation

@juanmigdr

@juanmigdr juanmigdr commented Jun 18, 2026

Copy link
Copy Markdown
Member

Description

formatPriceWithSubscriptNotation was capping decimal places at 4 for values under 1, which meant two similar thresholds like $0.00181069 and $0.00182069 would both display as $0.0018. Added a maximumFractionDigits override so the manage alerts list can pass 15 and preserve the stored precision.

Changelog

CHANGELOG entry: show correct decimal places when managing price alerts

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3404

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

image image

After

image image

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Low Risk
Display-only formatting with an opt-in override on a shared helper; no API or persistence changes.

Overview
Manage price alerts no longer collapses similar sub-dollar thresholds to the same rounded label (e.g. both showing $0.0018). The list now passes maximumFractionDigits: 15 into formatPriceWithSubscriptNotation so stored values like $0.00181069 and $0.00182069 stay distinguishable.

formatPriceWithSubscriptNotation gains an optional maximumFractionDigits override on the non-subscript path; default behavior elsewhere stays 2 decimals for ≥1 and 4 for <1. A regression test covers sub-cent threshold copy, and a small keypad doc example in create-alert was updated for extreme tiny prices.

Reviewed by Cursor Bugbot for commit 3612636. Bugbot is set up for automated code reviews on this repo. Configure here.

@juanmigdr
juanmigdr requested review from a team as code owners June 18, 2026 11:11
@juanmigdr
juanmigdr enabled auto-merge June 18, 2026 11:11
@metamask-ci

metamask-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Pre-merge author checklist has unchecked items (e.g. "I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR makes targeted, low-risk changes:

  1. CreatePriceAlertView.tsx: Only cosmetic changes (removed a comment, removed a blank line, updated a JSDoc example string). No functional logic changes.

  2. ManagePriceAlertsView.tsx: Adds { maximumFractionDigits: 15 } to a formatPriceWithSubscriptNotation call to preserve full precision for sub-cent price alert thresholds. This is a UI display fix for a feature-flagged component.

  3. format.ts (Predict utils): Extends FormatPriceWithSubscriptNotationOptions interface with an optional maximumFractionDigits property and updates formatPriceWithSubscriptNotation to use it when provided. This is a backward-compatible change — all existing callers (AssetOverview Price, TokenListItem, Bridge BatchSellTokenRow, Charts) continue to work with the same default behavior since the new parameter is optional with existing defaults.

  4. ManagePriceAlertsView.test.tsx: Adds a unit test for the new precision behavior.

Why no E2E tags are needed:

  • Price Alerts is a feature-flagged UI component with no existing E2E test coverage (no spec files found for PriceAlerts).
  • The formatPriceWithSubscriptNotation utility change is backward-compatible — no existing callers are affected.
  • The change does not touch any shared navigation, modals, confirmations, or core wallet flows.
  • SmokePredictions covers Polymarket prediction markets (not price alerts).
  • SmokeWalletPlatform covers token lists and asset loading, but the utility change is additive and non-breaking.
  • No performance-sensitive code paths are modified.

Performance Test Selection:
The changes are limited to UI display formatting for price alert thresholds and a backward-compatible extension of a formatting utility. No performance-sensitive code paths (asset loading, rendering loops, data fetching) are modified. No performance test tags are warranted.

View GitHub Actions results

@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 18, 2026

@MarioAslau MarioAslau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@juanmigdr
juanmigdr added this pull request to the merge queue Jun 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@juanmigdr
juanmigdr added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit 1840634 Jun 19, 2026
86 checks passed
@juanmigdr
juanmigdr deleted the fix/show-correct-decimal-places-manage-price-alerts branch June 19, 2026 07:45
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2026
@metamaskbot metamaskbot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 29, 2026
@gauthierpetetin

Copy link
Copy Markdown
Contributor

No release label on PR. Adding release label release-8.1.0 on PR, as PR was added to branch 8.1.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:low AI analysis: low risk size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants