Skip to content

perf(perps): defer heavy sections on PerpsMarketDetailsView - #40026

Open
mganchas wants to merge 1 commit into
mainfrom
perf/deferred-render-perps-market-details
Open

mganchas wants to merge 1 commit into
mainfrom
perf/deferred-render-perps-market-details

Conversation

@mganchas

@mganchas mganchas commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

What

Holds the sections that dominate PerpsMarketDetailsView's opening commit (statistics card, recent trades, "more" section, and the lower block with position lists plus the social or market-insights lists) out of the push transition.

The gate is the existing useScreenTransitionComplete() hook, called once with no arguments. No new hook or wrapper is added. Header, chart and primary actions stay eager.

Evidence

Earlier Reassure measurement (10 runs, local, not a CI gate) with a custom gate with the same release point: opening commit 39.08 ms → 26.97 ms (social path 46.1 → 27.5 ms). A TestFlight build using the plain hook was tested on a real device and the transition was fast.

Test layer placement

PerpsMarketDetailsView.test.tsx mocks useScreenTransitionComplete (default true) and adds one test for the held-back state.

Changelog

CHANGELOG entry: null

Related issues

Refs: #38039

Manual testing steps

Feature: Perps market details opening transition

  Background:
    Given the app is built with this branch
    And the user has perps enabled with at least one market available

  Scenario: Market details screen opens smoothly
    When the user taps a perps market from the markets list
    Then the market details screen pushes with a smooth transition
    And the header, price and chart render immediately
    And the statistics, recent trades, positions and social tabs render right after the transition ends

  Scenario: Social tabs path
    Given the perps social feature flag is enabled
    When the user opens a perps market
    Then the social tabs (positions/orders/traders) appear right after the transition ends

Screenshots/Recordings

N/A — no visual change; deferred sections render one frame after the opening transition instead of during it. Opening-commit measurements in the description.

Before

N/A

After

N/A

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.

@github-actions

Copy link
Copy Markdown
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.

@github-actions github-actions Bot added size-M pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Nov 18, 2026
@metamask-ci metamask-ci Bot added the team-mobile-platform Mobile Platform team label Nov 18, 2026
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from 6cb9a08 to 2e51f5a Compare November 18, 2026 16:16
@mganchas
mganchas force-pushed the perf/deferred-render-perps-market-details branch from 655ff77 to b720b1e Compare November 18, 2026 16:27
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from 2e51f5a to 8af1716 Compare November 18, 2026 16:33
@mganchas
mganchas force-pushed the perf/deferred-render-perps-market-details branch from b720b1e to 40079af Compare November 18, 2026 16:34
@mganchas
mganchas marked this pull request as ready for review November 18, 2026 16:38
@mganchas
mganchas requested a review from a team as a code owner November 18, 2026 16:38

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

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 40079af. Configure here.

@mganchas
mganchas force-pushed the perf/deferred-render-perps-market-details branch from 40079af to f55a182 Compare November 18, 2026 17:13
Hold the statistics, trades, related and social sections out of the opening
transition with the existing useScreenTransitionComplete hook.
@mganchas
mganchas force-pushed the perf/deferred-render-perps-market-details branch from f55a182 to 2bdf0f5 Compare November 18, 2026 18:57
@mganchas
mganchas requested review from a team as code owners November 18, 2026 18:57
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from d7a6a1f to 00fe69f Compare November 18, 2026 18:57
@mganchas
mganchas changed the base branch from feat/deferred-render-primitive to main November 18, 2026 18:58
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant