Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused mobile performance fix that restores memoization for existing feed, sidebar, task-provider, and branch-query computations. Its impact is limited to reducing redundant renders, subscriptions, and list churn, with no new user-facing capability or product-default change. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
6b3a539 to
46cdf10
Compare
Dismissing prior approval to re-evaluate 46cdf10
Note
🤖 Claude Opus 5.5 on behalf of Oliver
Problem
The mobile React Compiler migration (#21137, #21141, #21145, #21268) replaced manual
useMemowith plain values and left the caching to the compiler. For a few of those values, the compiler silently drops the cache scope. A value computed before a hook call and still used, or possibly mutated, after it can't sit in one cache block, because a block can't span a hook call. The compiler prunes the block without a build error, so the value is rebuilt on every render. #21867 fixed the same problem in the split-view layout. These four are what remained.Change
Restore
useMemowhere the compiler drops the scope, using the pre-migration deps updated for current code. Each memo gets a short comment explaining why, in #21867's style. Mobile lint already allows memo hooks (no-manual-memowithallowMemoHooks).state/queries.tsusePaginatedBranchespageAtoms,pagesAtomuseAtomValueresubscribes and renders the caller twice. HitsNewTaskFlowProviderand the scheduled-task branch pickerthreads/ThreadFeed.tsxpresentedFeedderiveThreadFeedPresentationreruns on copy feedback, row expands, and end-follow changes, and LegendList gets newdatawhilemaintainScrollAtEnd.onDataChangeis onthreads/new-task-flow-provider.tsxscratchEnvironments,environments(scratch path)NewTaskFlowContextvalue changes every render in scratch draftsthreads/ThreadNavigationSidebar.tsxlistItemsand its inputsdata.useThreadJumpShortcutsre-registers, which re-renders the app-rootHardwareKeyboardCommandProviderand resends nativeenabledCommandslistItemsand its uncached inputsThe sidebar needed more than
listItems. Memoizing it alone made the compiler skip the whole component ("Existing memoization could not be preserved"), andlistItems' inputs were rebuilt every render anyway. This restores the pre-#21145 memos onmatchedThreadKeys,selectedProjectScope,selectedProjectRefs,threadMoveAvailability, andthreadListV2Layout, with deps on the currentnowclock state instead of the oldnew Date()plus tick deps.Scope and approval
This is a focused performance fix that restores caching the compiler migration meant to keep. It follows the approach maintainers already merged in #21867. There is no behavior change.
AdaptiveWorkspaceLayout.tsxandThreadFilesRouteScreen.tsxare left to a separate PR.Verification
babel-preset-expousing Metro's iOS release caller flags and a compiler logger. Each restored value is now read from a$[n]cache slot, including every input in the sidebar chain. There are no newCompileErrorevents and no file added toKNOWN_BAILOUTS. Pruned scopes per component:usePaginatedBranches1 → 0,ThreadFeed2 → 1, sidebar unchanged (the remaining scopes are other values).@effect/atom-reactmeasured theusePaginatedBranchespattern: 2 renders per parent update before, 1 after. The other three are React Native components that the harness can't mount, so the compiler output is the evidence for them.vp test run src/reactCompilerCoverage.test.tspassed (879). Mobiletypecheckpassed.vp linton the four files shows no new warnings.Claude Opus 5.5 via Claude Code in T3 Code