Skip to content

Avoid rebuilding committed mobile files while typing - #26196

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-mobile-branch-footer
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-mobile-branch-footer

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​314 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​314
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14

ELI5

Typing a commit message no longer rebuilds the list of files already committed on the branch after every character.

What Changed

Keep the existing committed-file footer element while its nine inputs stay the same. Changes to branch files, compare status, summary, opening paths, busy state, or the file-opening callback still update it immediately. Both the ordinary file list and the branch-only scroll view use the same footer.

Why

The commit message updates the parent component, which previously rebuilt every committed row and icon even though their data had not changed. A component-local useMemo removes that repeated work without changing the list, scrolling, text, callbacks, or update timing. It retains one current element rather than introducing a separate data cache or delaying input updates.

A generated fixture rendered the actual component, React Native Web, and icons with production React in a hidden Chrome 150 renderer on macOS. Across seven alternating trials of 50 input-state publications, median time per publication was:

Committed files Before After
0 0.278 ms 0.282 ms
20 1.462 ms 0.282 ms
100 6.672 ms 0.282 ms
500 37.066 ms 0.326 ms

This fixture used generated file data and a state wrapper; it did not exercise a physical phone or host RPC. Playwright also typed into the real rendered text input and clicked committed-file rows. The final source matched the frozen original across 14 scenarios and independent changes to all nine footer inputs, including replacement callbacks. Fifty input updates still produced fifty React commits, while committed-row traversals fell from 50 to zero (1,000 row visits to zero with 20 files).

Linked Issue

N/A — maintainer performance audit.

Visual Proof

N/A — the rendered UI and interactions are unchanged. This change avoids rebuilding an unchanged footer during typing; the rendered comparison verified text, row counts, disabled states, and callbacks.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Three actual-component tests cover both list layouts, 50 text-input changes, and all footer inputs. The frozen original fails the count regression with 1,000 repeated row-format calls; the final source makes zero. Five affected test files / 20 tests pass.

Mobile production typecheck and the test typecheck ratchet pass (934 test files, existing 123-file baseline unchanged). Ordinary oxlint, formatting, and the changed-code quality gate pass without suppressions. The full mobile web build and packaged verifier pass: 16 routes, 74 chunks, 124 assets, 7,965,234 bytes.

Local rendered validation used a hidden Electron renderer on macOS with ORCA_BACKGROUND_LAUNCH=1; the owned app and CDP listener were closed afterward. No physical Android/iOS test was performed. The change adds no platform, file-path, Git-provider, SSH, or wire behavior.

Review

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a109aa58-c77f-4483-bf99-6bd3c64145a1
📥 Commits

Reviewing files that changed from the base of the PR and between b8c9671 and 4212d94.

📒 Files selected for processing (2)
  • mobile/src/source-control/MobileSourceControlContent.test.tsx
  • mobile/src/source-control/MobileSourceControlContent.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

MobileSourceControlContent now memoizes the BranchCompareFooter element based on its displayed state and callbacks. New tests check footer updates, branch rendering across commit-message changes, row states, branch-diff opening, compare errors, section visibility, and disconnected-state messaging.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 4212d

The footer optimization is ready to merge after normal checks; no concrete merge-blocking issue remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing committed mobile files from being rebuilt while typing.
Description check ✅ Passed The description covers the change, reason, testing, visual-proof exception, linked-issue status, and checklist. It is detailed and mostly complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 7610920 into main Oct 8, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant