Skip to content

feat: allow custom sorting in perps from explore cp-7.77.0#29912

Merged
juanmigdr merged 4 commits into
mainfrom
feat/allow-custom-sorting-perps
May 8, 2026
Merged

feat: allow custom sorting in perps from explore cp-7.77.0#29912
juanmigdr merged 4 commits into
mainfrom
feat/allow-custom-sorting-perps

Conversation

@juanmigdr
Copy link
Copy Markdown
Member

@juanmigdr juanmigdr commented May 8, 2026

Description

Allow custom sorting in perps from explore

Changelog

CHANGELOG entry: allow custom sorting in perps from explore

Related issues

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

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

After

Screen.Recording.2026-05-08.at.14.09.40.mov

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

Medium Risk
Medium risk because it changes default sorting behavior and navigation params for the Perps market list, which can affect perceived ordering and persisted sort direction across screens.

Overview
Explore → Perps market list navigation now forwards a default sort option via new defaultSortOptionId route param so the full market list opens with the same ordering as the Explore feed.

usePerpsMarketListView accepts this override and resets sort direction to the controller default when the override differs from the user’s saved option, while preserving the saved direction when it matches. usePerpsFeed now exposes a per-variant defaultSortOptionId (backed by PERPS_VARIANT_SORT_OPTION) and keeps search ordering consistent (Fuse relevance preserved for non-macro; macro still sorts by volume).

Explore perps sections (NowTab, CryptoTab, MacroTab, RwasTab, PerpsToggleBlock) were updated to pass the sort option through, and new/updated unit tests cover the override logic and navigation wiring. useStocksFeed was adjusted so search results include RWAs across chains, while the tab view remains Ethereum-only, with tests added.

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

@juanmigdr juanmigdr requested a review from a team as a code owner May 8, 2026 12:09
@github-actions github-actions Bot added the size-M label May 8, 2026
@juanmigdr juanmigdr enabled auto-merge May 8, 2026 12:10
Comment thread app/components/Views/TrendingView/feeds/perps/usePerpsFeed.ts Outdated
@juanmigdr juanmigdr added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label May 8, 2026
@github-actions github-actions Bot added size-L and removed size-M labels May 8, 2026
Comment thread app/components/UI/Perps/hooks/usePerpsMarketListView.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on two areas:

  1. Perps sorting/navigation improvements: Added defaultSortOptionId parameter to PerpsMarketListView and related hooks/navigation so that when a user taps "View All" from a Trending feed section, the market list opens pre-sorted to match the feed's display order. This touches PerpsMarketListView.tsx, usePerpsMarketListView.ts, navigation.ts, usePerpsFeed.ts, perpsNavigation.ts, and PerpsToggleBlock.tsx.

  2. TrendingView tab updates: All four Trending tabs (CryptoTab, MacroTab, NowTab, RwasTab) were updated to pass the defaultSortOptionId through their "View All" navigation calls. Additionally, useStocksFeed.ts was enhanced to show all RWA chains during search (not just Ethereum mainnet).

SmokePerps is required because:

  • Core Perps market list view behavior changed (sort initialization logic)
  • Navigation parameter passing changed
  • The usePerpsFeed hook's sort logic was refactored

SmokeWalletPlatform is required because:

  • Multiple TrendingView tabs (CryptoTab, MacroTab, NowTab, RwasTab) were modified
  • The Trending tab is the primary surface tested by SmokeWalletPlatform
  • Stocks feed filtering behavior changed (search now shows multi-chain results)

Per tag descriptions: SmokePerps changes to Perps views affect Trending (SmokeWalletPlatform), so both tags are needed. SmokeConfirmations is not needed as no confirmation flows were changed. No controller, Engine, or security-critical code was modified.

Performance Test Selection:
The Perps market list view sorting logic was refactored (usePerpsFeed.ts, usePerpsMarketListView.ts) with new sort function mappings and initialization logic. These changes affect how the Perps market list renders and sorts data, which could impact the @PerformancePreps test that covers perps market loading and position management. The refactoring of sort initialization (isOptionOverridden logic, SORT_FNS map) could introduce subtle performance differences in list rendering.

View GitHub Actions results

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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 ddc377c. Configure here.

Comment thread app/components/Views/TrendingView/feeds/perps/usePerpsFeed.test.ts
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@juanmigdr juanmigdr added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 2ccad65 May 8, 2026
94 checks passed
@juanmigdr juanmigdr deleted the feat/allow-custom-sorting-perps branch May 8, 2026 15:58
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-L skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants