Skip to content

fix(mobile): skip unhandled animation events on Android - #13325

Open
AKolenda wants to merge 1 commit into
pingdotgg:mainfrom
AKolenda:fix/mobile-thread-cache
Open

AKolenda wants to merge 1 commit into
pingdotgg:mainfrom
AKolenda:fix/mobile-thread-cache

Conversation

@AKolenda

@AKolenda AKolenda commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Android can become unresponsive while returning from Settings and scrolling a populated thread list. Captured ANRs repeatedly enter NodesManager.onEventDispatch from SVG layout events, flush non-layout updates during drawing, and log missing-view exceptions from NativeProxy.synchronouslyUpdateUIProps.

Extend the existing Reanimated 4.5.5 patch to skip UI-thread events with no animation listener before dispatching or flushing operations. This follows the listener check already used by the background event queue and the C++ raw-event path. Include listeners registered without a view tag in that check, so they continue receiving events.

Verification:

  • Built the optimized Android release with React Native 0.86.3 and Reanimated 4.5.5.
  • Reproduced offline on an Android emulator with a populated SQLite cache and generic visible project/thread names. No server requests or real login credentials were needed.
  • Five Settings/back/scroll cycles: original build logged 1,617 failed synchronous updates; final patch logged zero. The replay asserts that Settings opens and the home screen returns, rather than treating an empty log as success.
  • A longer 12-cycle pass with the event guard logged zero failures. Reinstalling the original build reproduced 705 failures in five cycles.
  • A separate native scroll fixture confirmed that both view-specific and global animation listeners fire.
  • Applied the complete patch to the official npm tarball and verified that it produces the native sources used in the build. Regenerated the pnpm lockfile and checked the diff.

This fixes the reproduced native rendering loop. It does not change cache policy or claim to resolve unrelated server/connection delays. The physical phone supplied the original ANR evidence; the patched build was verified on an emulator.

Model: OpenAI GPT-6. Harness: Codex desktop, Android emulator, ADB, Gradle release build, and a local replay fixture.

Android performance series

These are separate PRs, each reviewable on its own:

Summary by CodeRabbit

  • Bug Fixes
    • Improved layout-animation cleanup so animations marked to exit are not retained during subsequent updates.
    • Updated cancellation handling for settled animations.
    • Improved Android UI-event handling by dropping events when no matching handler is available.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 24, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 24, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This focused Android fix changes the existing Reanimated event path to skip dispatch and UI-operation flushing when no animation listener is present. Because it gates significant downstream work on runtime handler state, the behavior change warrants human review.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e2d1df33-fd4d-4f72-b868-deffc8690ccb

📥 Commits

Reviewing files that changed from the base of the PR and between effaab9 and 87783f0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • patches/react-native-reanimated@4.5.5.patch

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The patch changes settled layout-animation handling in both proxies. It also changes Android UI-thread event dispatch to drop events when their names cannot be resolved or no matching handler is waiting.

Changes

Layout animation settlement

Layer / File(s) Summary
Settled animation handling
patches/react-native-reanimated@4.5.5.patch
LayoutAnimation gains an exit flag. Both proxies set it when the animation count reaches zero and use it to determine how settled animations are handled. The experimental proxy also sets the flag when cancellation finds an already-settled animation.

Android UI event dispatch

Layer / File(s) Summary
Event handler lookup and dispatch
patches/react-native-reanimated@4.5.5.patch
The UI-thread event path returns early if the event name cannot be resolved or no handler is waiting for that event name and view tag. The registry reports an event as available when it has an untagged handler.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 87783

No merge-blocking issue was established; the change can proceed through normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Title check ✅ Passed The title clearly and concisely describes the main change: skipping unhandled animation events on Android.
Description check ✅ Passed The description explains what changed, why it changed, verification results, scope, and test environment. It omits the template checklist and a separate UI Changes section, but it is otherwise substan…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

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

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants