chore: align data fetch on stocks#29795
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 7402fc8. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29795 +/- ##
==========================================
+ Coverage 81.44% 81.49% +0.04%
==========================================
Files 5318 5319 +1
Lines 140909 140914 +5
Branches 32109 32108 -1
==========================================
+ Hits 114767 114839 +72
+ Misses 18263 18229 -34
+ Partials 7879 7846 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
No other flows (confirmations, accounts, network, swap, identity, browser, snaps) are affected by these changes. Performance Test Selection: |
|




Description
The
useStocksFeedhook was passingchainIds: ['eip155:1']touseRwaTokenswhen no search query was active, restricting the API fetch to Ethereum mainnet only. TheRWATokensFullView(full-screen Stocks view) fetches from all RWA-supported chains (Ethereum + BNB Chain) by default.This mismatch caused the two views to operate on different datasets, leading to inconsistent sort order: tokens available on BNB Chain (e.g. Cipher Mining Ondo Tokenized) appeared at the top of the full-screen view due to a higher 24h price change, but were completely absent from the section widget, making a lower-ranked Ethereum token incorrectly appear first there.
The fix removes the
chainIdsoverride fromuseStocksFeedso it fetches the same combined dataset as the full-screen view. A client-side filter is then applied to return only Ethereum mainnet tokens to the section, preserving the intended display scope while correctly reflecting the global sort order.Changelog
CHANGELOG entry: align data fetch on stocks
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3149 & https://consensyssoftware.atlassian.net/browse/ASSETS-3155 & https://consensyssoftware.atlassian.net/browse/ASSETS-3154
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Moderate UI/data behavior change: alters what assets appear in Trending sections by shifting RWA chain filtering client-side and optionally hiding risky tokens, which could affect ordering/visibility but not security-critical flows.
Overview
Aligns the Trending Stocks section with the full RWA dataset by removing the
chainIdsconstraint from theuseRwaTokensrequest and instead filtering to Ethereum mainnet locally (byassetIdCAIP prefix) to avoid cache divergence and inconsistent sorting.Adds an optional
hideRiskyTokensflag touseTokensFeedto filter out tokens markedWarning,Spam, orMalicious(keepingVerified,Benign, and unscanned), enables it for the Crypto movers pills inNowTab, and extends unit tests to cover the new filtering behavior.Updates English strings so the RWA perps section/pill labels display "Perps" instead of "Markets"/"Stocks & commodities".
Reviewed by Cursor Bugbot for commit ed1be03. Bugbot is set up for automated code reviews on this repo. Configure here.