Repository navigation
feat: add wide screen token table sort controls - #47835
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨💎 @MetaMask/metamask-assets (8 files, +784 -117)
|
Accessibility (draft)I know this is still a draft, so no rush. Just flagging for when you wrap up. The new sort headers in An AI accessibility agent posted this. If this is wrong, reply here. |
Builds ready [4dac669]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 3 warn · 🔴 3 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [47936eb]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 2 warn · 🔴 3 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a139be4. Configure here.
Builds ready [a139be4]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 3 warn · 🔴 4 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [effbca3]
⚡ Performance Benchmarks (Total: 🟢 10 pass · 🟡 1 warn · 🔴 2 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [c6351b3]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 5 warn · 🔴 3 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [3d99580]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 5 warn · 🔴 3 fail)
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
|
|
| const marketData = useSelector(getMarketData); | ||
| const currencyRates = useSelector(getCurrencyRates); | ||
| const conversionRates = useSelector(getAssetsRates); |
There was a problem hiding this comment.
Selectors I think you're using are okay. Long term we do want to get rid of these messy & complex selectors and have teams just rely on using the AssetsController object (no weird selector conversions needed).
There was a problem hiding this comment.
In this example I would love if we used directly a selector that uses AssetsController.assetPrices - right now I'm pretty sure these selectors come from some translation logic (mapping our new state to some legacy state)
There was a problem hiding this comment.
Ooh. Probably! Is that something your team is working on or you're mentioning as a general thought? I'm happy to consider that approach when I next touch these




Description
This PR affects the new wide screen experience only, where the Token List renders as a new Token Table. This PR adds in sort controls to the 4 headers: Token, Price, 24h Change, Balance. When sorted, they stay local to the table and are not written to the saved sort preference (the existing
tokenSortConfig). So the sort preference in state is unchanged, and DeFi still uses that preference, as well as non-widescreen Token List.The down arrow is the default: A–Z, or the highest value first. The first click on a column selects that default. Another click reverses it. Missing and non-finite prices and 24h changes sort last in both directions. Equal prices and changes fall back to the token name. Low-balance tokens collapse only for a high-to-low balance sort. Changing the saved sort clears the header selection.
If a user hasn't sorted on the table, it will show the active sort currently being used in the
tokenSortConfigi.e. Token (alphabetical) or Balance (descending).Changelog
CHANGELOG entry: Adds sort controls to the wide screen Token Table
Related issues
Part fixes: https://consensyssoftware.atlassian.net/browse/CEUX-1482
Manual testing steps
Screenshots/Recordings
Before
After
token.table.sort.behaviour.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
UI-only sorting and shared price read helpers with test coverage; saved global sort preference behavior is explicitly preserved.
Overview
Adds click-to-sort headers on the wide-screen Token Table for Token, Price, 24h Change, and Balance. Sorting is session-local (not written to
tokenSortConfig); the UI reflects the saved preference until a header is clicked, then clears header sort when that preference changes. Headers show direction arrows and accessible sorted ascending/descending labels.Sorting is driven by a new
sortTokenAssetspath (optional header override) wired throughuseTokenSortOverrideand an optionalsortOverrideonuseTokenListData. Price and 24h sorts use sharedgetCachedSpotPrice/getCachedPercentChangehelpers (also used byuseCachedPriceand token cell 24h display). Missing/non-finite values sort last; low-value token collapse still applies only for high-to-low balance sort.Locale strings and broad unit/integration tests cover header toggling, preference reset, and sort ordering.
Reviewed by Cursor Bugbot for commit 3d99580. Bugbot is set up for automated code reviews on this repo. Configure here.