release(runway): cherry-pick fix(perps): percent issue on markets page cp-13.28.0#41969
Merged
chloeYue merged 1 commit intorelease/13.28.0from Apr 20, 2026
Merged
Conversation
…e cp-13.28.0 (#41941) ## **Description** The 24h percentage change on the perps markets list was sometimes displayed without the `%` suffix. This happened because the WebSocket live-price stream can emit `percentChange24h` values without a trailing `%` (e.g. `+2.84` instead of `+2.84%`). `usePerpsLiveMarketListData` merges that value directly into `market.change24hPercent` with no normalization, and `MarketRow` was rendering the raw string. The detail page and market cards already guard against this using `formatChangePercent` / `formatSignedChangePercent` from `utils.ts`. This fix applies the same `formatSignedChangePercent` normalization inside `MarketRow` — both for the right-side change column and for the secondary `priceChange` metric display — so the `%` symbol is always present regardless of whether the value came from REST or WebSocket. ## **Changelog** CHANGELOG entry: Fixed a bug where the 24h percentage change on the perps markets page was sometimes displayed without the `%` symbol. ## **Related issues** Fixes: ## **Manual testing steps** 1. Open the MetaMask extension and navigate to the Perps section. 2. Open the Markets list page. 3. Observe the 24h change column — all values should display with a `%` suffix (e.g. `+2.84%`, `-1.23%`). 4. Wait for the WebSocket live-price stream to push updates and confirm the `%` remains present after a live update. ## **Screenshots/Recordings** ### **Before** ### **After** <img width="492" height="971" alt="Screenshot 2026-04-20 at 13 43 56" src="https://github.com/user-attachments/assets/10450641-1516-402e-8332-27e551c6c824" /> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk UI formatting change that only normalizes the `change24hPercent` string; limited to display logic plus a small test addition. > > **Overview** > Ensures the perps markets list always shows a properly formatted 24h change percent by routing `market.change24hPercent` through `formatSignedChangePercent` (adds missing `%` and normalizes sign) in `MarketRow`, including the secondary `priceChange` metric. > > Adds a regression test covering the live-stream case where the percent value arrives without a trailing `%`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b4e7856. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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. |
|
Contributor
Builds ready [7c60d78]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 12 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
The 24h percentage change on the perps markets list was sometimes
displayed without the
%suffix. This happened because the WebSocketlive-price stream can emit
percentChange24hvalues without a trailing%(e.g.+2.84instead of+2.84%).usePerpsLiveMarketListDatamerges that value directly into
market.change24hPercentwith nonormalization, and
MarketRowwas rendering the raw string.The detail page and market cards already guard against this using
formatChangePercent/formatSignedChangePercentfromutils.ts.This fix applies the same
formatSignedChangePercentnormalizationinside
MarketRow— both for the right-side change column and for thesecondary
priceChangemetric display — so the%symbol is alwayspresent regardless of whether the value came from REST or WebSocket.
Changelog
CHANGELOG entry: Fixed a bug where the 24h percentage change on the
perps markets page was sometimes displayed without the
%symbol.Related issues
Fixes:
Manual testing steps
%suffix (e.g.
+2.84%,-1.23%).the
%remains present after a live update.Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask
Extension Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Low Risk
Low risk UI formatting change that only normalizes the
change24hPercentstring; limited to display logic plus a small testaddition.
Overview
Ensures the perps markets list always shows a properly formatted 24h
change percent by routing
market.change24hPercentthroughformatSignedChangePercent(adds missing%and normalizes sign) inMarketRow, including the secondarypriceChangemetric.Adds a regression test covering the live-stream case where the percent
value arrives without a trailing
%.Reviewed by Cursor Bugbot for commit
b4e7856. Bugbot is set up for automated
code reviews on this repo. Configure
here.