perf(mobile): stop menu fault logging and whole-list re-renders on Home #24646
main fromrefs/pull/24646/head·merged by juliusmarminge View on GitHubOpening a workspace tab for the first time felt slow, and Home kept re-rendering its whole thread list while nothing was happening. Profiling on the iPhone Duo simulator found three causes, all already on main.
Menu actions without an icon logged a CoreUI fault each#
Fabric sends a menu action's missing image as "". @react-native-menu/menu tried UIImage(systemName: ""), then UIImage(named: ""), and every empty asset lookup logged a CoreUI fault with a backtrace: thousands per session, and about 50 ms of main-thread work while the Pull requests tab first mounts, since its filter menus build many actions. Our existing patch now treats an empty image as no image. 2.0.0 is still the latest release and has the same code.
This changes native code, so it needs a new native build.
Home rebuilt its whole thread list on unrelated renders#
Home and the thread sidebar built their list inline and recorded inbox returns as a side effect during render. The React Compiler could cache none of it: the list's inputs stayed open to mutation across the screen's other hooks. So every render of Home rebuilt the list, re-rendered every visible row and re-registered the thread jump shortcuts. Home re-renders whenever the connection status flips, every few seconds, and when you leave the Chats tab.
useThreadListV2builds the list for both screens, so its result reaches them as one cached value.- The inbox tracker's
observereturns a fixed lookup per observation and runs only when the threads change. - The row select handler no longer depends on the rebuilt layout or on Home's whole
propsobject.
Measurements#
iPhone Duo simulator, dev build, Chats tab idle, render timings from React's per-fiber durations:
| Commits | Full-list re-renders | Render time | |
|---|---|---|---|
| Before, 40 s | 69 | 22 | 1278 ms |
| After, 70 s | 57 | 1 | 322 ms |
The remaining full-list commit is the once-a-minute snooze-menu clock, which every row legitimately shows. Leaving Chats for another tab no longer re-renders the Chats list.
Production bundle on the same simulator, cold switch to Pull requests: main-thread view creation went from about 85 ms to about 20 ms, and CoreUI "Invalid asset name" faults from thousands per session to 0.
Verification#
vp run check:changedpasses, and the React Compiler coverage test, home and threads suites (1171 tests).- The tracker's test covers the new contract: an earlier observation's lookup keeps its answer.
- Compiled output checked: the layout, list items and Home's select handler sit behind cache checks.
- Not measured: iPad and iPhone, and a streaming turn. Thread rows now re-render only when their own item changes, which is what a streaming turn needs.
Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
Approvability#
Verdict: Approved at
18fc403Macroscope's review found this PR approvable — This is a bounded mobile performance fix that centralizes existing thread-list construction, stabilizes row callbacks, snapshots inbox ordering, and skips empty native menu image lookups. It changes rendering efficiency and native fault logging without introducing new product capability, schema changes, or product-default changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
6548c00· PR result:18fc403· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: t3code/mobile-render-perf
- File: .coderabbit.config.ts
- Commit: 18fc403
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
ccbf925b-a4ef-4fe0-b69f-fca3b155328a
Commits-
Reviewing files that changed from the base of the PR and between 6548c006d429e7242ebc10c34946420418a276ec and 18fc403714dcc03a86301fbb09909bb56f7ab594.
Files ignored due to path filters: 1-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
Files selected for processing: 6-
apps/mobile/src/features/home/HomeScreen.tsxapps/mobile/src/features/threads/ThreadNavigationSidebar.tsxapps/mobile/src/features/threads/useThreadListV2.tspackages/client-runtime/src/state/threadInbox.test.tspackages/client-runtime/src/state/threadInbox.tspatches/@react-native-menu__menu@2.0.0.patch
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
Walkthrough
-
The home screen and navigation sidebar now use
useThreadListV2to build thread lists. Inbox-return observations now provide snapshot-based timestamp lookups. The iOS menu patch also changes menu presentation, action conversion, and image lookup behavior.Changes: Thread List Construction
Layer / File(s) Summary Inbox return timestamp snapshots
packages/client-runtime/src/state/threadInbox.ts,packages/client-runtime/src/state/threadInbox.test.tsobservenow returns a timestamp lookup based on a snapshot of the tracker state. Tests check that lookups from earlier observations retain their original results.Shared thread-list hook
apps/mobile/src/features/threads/useThreadListV2.tsThe new hook builds the thread-list layout and items, filters pending tasks, computes move availability, and returns content-only thread keys. Home screen integration
apps/mobile/src/features/home/HomeScreen.tsxThe home screen uses the hook’s layout, items, and content-only keys for selection and search-match handling. Sidebar integration
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsxThe sidebar uses the hook’s layout, items, and content-only keys. It appends a show-more row when the settled shelf is expanded and hidden items remain. iOS Menu Patch
Priority:Layer / File(s) Summary Native menu behavior updates
patches/@react-native-menu__menu@2.0.0.patchThe patch adds menu interaction-start events, updates menu presentation while menus are active, serializes an additional action level, assigns stable submenu identifiers, and adds iOS 15+ submenu subtitles. Image lookup skips empty names. NormalEstimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Suggested labels:
bugfix,📱 Native ChangeSuggested reviewers:
t3dotgg,maria-rcks
Merge Risk:
Minimal · up to18fc4-
The supplied evidence does not establish a merge-blocking issue; the reported checks still need their normal validation before merging.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description explains the problem, implementation, measurements, verification, and limitations. It omits the required Scope and approval section and does not include the required before/after UI ev… Add a Scope and approval section with the related issue or explicit maintainer approval, or explain why this focused fix qualifies for an exemption. Add clear before/after screenshots for the UI performance changes. Passed checks: 3 passed-
Check name Status Explanation Title check The title clearly identifies both primary changes: stopping menu fault logging and preventing unnecessary whole-list re-renders on Home. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
Full details: Description check
-
Explanation
The description explains the problem, implementation, measurements, verification, and limitations. It omits the required Scope and approval section and does not include the required before/after UI evidence.
Resolution
Add a Scope and approval section with the related issue or explicit maintainer approval, or explain why this focused fix qualifies for an exemption. Add clear before/after screenshots for the UI performance changes.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged this62eb35b
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes