Skip to content

docs(performance): use useScreenTransitionComplete to defer heavy sections - #38039

Open
mganchas wants to merge 1 commit into
mainfrom
feat/deferred-render-primitive
Open

mganchas wants to merge 1 commit into
mainfrom
feat/deferred-render-primitive

Conversation

@mganchas

@mganchas mganchas commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

What

Docs only. Agents (and people) keep reaching for a new deferral hook when a heavy section janks a push transition, but useScreenTransitionComplete already exists in app/components/hooks/ (added in #34575 to open the keyboard after a push) and does the job.

This PR adds the guidance for when and how to use it:

  • docs/performance/anti-patterns.md: a short "Deferring a heavy section until the push transition ends" section (snippet, when to do it, when not to, test tip), linked from "Eager / redundant work on mount".
  • AGENTS.md: one Quick Reference line pointing agents at that section.

No code changes. An earlier revision of this PR added a useDeferredRender hook and a <DeferredRender> wrapper. A TestFlight build that used the plain useScreenTransitionComplete() on Perps, TokenDetails and Top traders was just as fast on a real device, so the extra primitive was dropped. The screen adoptions now consume the existing hook: #40028, #40026, #40022, #40025.

Changelog

CHANGELOG entry: null

Related issues

Refs: N/A (docs only)

Manual testing steps

N/A. Documentation only.

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

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 cursor Bot mentioned this pull request Oct 22, 2026
5 of 10 tasks
@github-actions github-actions Bot added size-XL pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels Oct 22, 2026
@metamask-ci metamask-ci Bot added the team-mobile-platform Mobile Platform team label Oct 22, 2026
@metamask-ci

metamask-ci Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has only 5 of the required 8 items. Every checklist row must be present and consciously checked — do not delete rows.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions github-actions Bot added size-M and removed size-XL labels Oct 22, 2026
@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-L and removed size-M labels Oct 27, 2026
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from 025699f to b2a1ab2 Compare November 18, 2026 11:21
@github-actions github-actions Bot added size-XL and removed size-L labels Nov 18, 2026
@mganchas
mganchas marked this pull request as ready for review November 18, 2026 11:36
@mganchas mganchas removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: ALL

AI Confidence: 100

E2E reasoning

Expand to read

I narrowed the seed from ALL to two tags. The seed's global-infrastructure rule matched on the path, but this hook is not globally mounted. It is also not part of Engine, the store, or the app startup path. The change adds an opt-in DeferredRender component. It also adds a context, new trace enums, and options for the existing hook (enabled, mode, fallbackMs, screenId). Existing callers use useScreenTransitionComplete() with no arguments, so the signature stays compatible. The timing is slightly different, because release now waits for a requestAnimationFrame inside startTransition after transitionEnd. The hook has six consumers: Card auth, Card MFA, Card onboarding confirm email and phone, Ramp native-flow OtpCode, TrendingView ExploreSearchScreen, and SocialPostComposerView. Card and Ramp map to SmokeMoney. ExploreSearch is part of Trending, which maps to SmokeWalletPlatform. The Social composer has no matching smoke tag. The CardAuthentication test change and the trace.ts additions don't need extra tags. I didn't select SmokeConfirmations, SmokeSwap or the other tags, because no swap or transaction flow is touched.

View run

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

Stale Bugbot comment from a previous run.

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

There are 3 total unresolved issues (including 2 from previous reviews).

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 6cb9a08. Configure here.

@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from 6cb9a08 to 2e51f5a Compare November 18, 2026 16:16
@github-actions github-actions Bot added size-L and removed size-XL labels Nov 18, 2026
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from 2e51f5a to 8af1716 Compare November 18, 2026 16:33
@mganchas
mganchas requested a review from a team as a code owner November 18, 2026 17:06
…ferring heavy sections

Document when to gate a heavy below-the-fold section on the existing
useScreenTransitionComplete hook instead of writing a new deferral hook.
@mganchas
mganchas force-pushed the feat/deferred-render-primitive branch from d7a6a1f to 00fe69f Compare November 18, 2026 18:57
@github-actions github-actions Bot added size-XS and removed size-L labels Nov 18, 2026
@mganchas mganchas changed the title feat(ui): add opt-in DeferredRender primitive docs(performance): use useScreenTransitionComplete to defer heavy sections Nov 18, 2026
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant