Repository navigation
fix(mobile): Android diff no longer stalls when comment cards scroll into view - #25994
bartlomiejbloniarz wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Android performance fix that replaces repeated text measurements in existing comment and notice rendering with a single fitting calculation, while adding a focused regression test. It does not change product defaults or introduce new capabilities, schemas, infrastructure, or sensitive-area behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Prefix measurement and validation apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt, apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffGeometryTest.kt |
ellipsize is now module-visible and uses Paint.breakText to select a prefix. The test checks that a long comment uses at most two text measurements, ends with ..., and fits within 300 pixels. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 20b9c
-
No merge-blocking risk was identified in the reviewed changes.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description includes all required sections. It explains the Android performance problem, the Paint.breakText fix, scope and approval rationale, focused test results, emulator verification, before-and-after metrics, and the physical-device limitation.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Closing as superseded by #26174, which fixes the same quadratic measurement and also caps the measured text. |
Problem
On Android, scrolling a pull request's changes stalls whenever a comment card is on screen. Each frame takes over a second when the comments are long, as bot reviews often are. Reproduce with
software-mansion/react-native-reanimated#10880: openSharedTransitions.cppand scroll past its comments on lines 375–395.Change
A comment card shows one line of its comment, cut to fit with "...". The cut removed one character at a time and re-measured the remaining text after each removal, on every frame. A 9,000-character comment meant thousands of text measurements per card per frame.
The cut now asks Android's text measurement for the fitting length in one call (
Paint.breakText). It also no longer splits an emoji or other surrogate pair in half. Notice rows use the same helper and get the same speedup.Scope and approval
A small fix for an obvious performance bug in the Android diff view. It changes one helper and adds a regression test. iOS draws comment cards differently and is not affected.
Verification
ellipsizingALongCommentDoesNotRemeasureItPerCharactercounts text measurements for one long comment. It fails before the fix (6,181 measurements) and passes after. The whole Android native suite (apps/mobile/modules/t3-review-diff/tests/run-android.sh) passes.dumpsys gfxinfo:Android emulator, software-mansion/react-native-reanimated#10880,
SharedTransitions.cpp, same swipes from line 233 down past the commentsandroid-before.mp4
android-after.mp4
Not checked on a physical Android device.
Claude Opus 5.5 in Claude Code, run from T3 Code.