Skip to content

perf(mobile): keep live chats responsive - #393

Merged
elie222 merged 3 commits into
elie222:mainfrom
luinbytes:t3code/optimize-chat-performance
Aug 30, 2026
Merged

perf(mobile): keep live chats responsive#393
elie222 merged 3 commits into
elie222:mainfrom
luinbytes:t3code/optimize-chat-performance

Conversation

@luinbytes

@luinbytes luinbytes commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • virtualize active DM and group transcripts with an inverted FlatList instead of mounting the full conversation
  • memoize message bubbles, stabilize their action handlers, and replace per-message reply scans with one lookup map
  • retain the bounded ScrollView only for search around-pages so variable-height message jumps remain exact

QA

  • resource-limited Android 36 emulator: 2 vCPU, headless, 720x1280, no audio or boot animation
  • synthetic 200-message markdown transcript with progress updates every 50 ms remained interactive and visibly advanced through Working 409
  • variable-height search jump landed exactly on Message 25
  • mobile tests: 77 passed
  • chat-ui tests: 4 passed
  • mobile Expo dependency and TypeScript checks passed
  • production Android Hermes export passed with one Metro worker
  • native Android debug assembly passed with one Gradle worker and a 1536 MB heap

Broader repository check

A bounded full Vitest run reached 1,520 passing and 8 skipped tests. It also exposed pre-existing setup/baseline issues outside this change: 34 suites cannot load the absent generated Prisma client, and one desktop sandbox inode-containment test fails. The mobile-scoped gates above are green.

Summary by CodeRabbit

  • Improvements
    • Updated the thread view for smoother, more responsive message scrolling.
    • Added dedicated scrolling for pinned content and jump-to-message navigation.
    • Improved loading and navigation when viewing older messages.
    • Improved message rendering performance for more responsive interactions.
    • Updated answer, bot, and speak actions to work directly with the selected message.

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
rakazo-www Skipped Skipped Aug 30, 2026 7:47am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16a3cc42-133e-4926-bae5-5f9120d26452

📥 Commits

Reviewing files that changed from the base of the PR and between 7869b81 and 89355b1.

📒 Files selected for processing (1)
  • apps/mobile/app/thread.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The mobile thread screen now uses an inverted FlatList for messages and a separate ScrollView for pinned pages. Callback functions are memoized. MessageBubble is memoized and receives the current message in answer and speak handlers.

Changes

Mobile thread rendering

Layer / File(s) Summary
Scroll and callback state
apps/mobile/app/thread.tsx
Scroll refs now target FlatList<MobileMessage> and pinned-page scrolling. Loading preserves pinned-page targets. Several handlers now use useCallback.
Message list and pinned-page rendering
apps/mobile/app/thread.tsx
The main thread renders reversed messages with an inverted FlatList. Pinned pages render through a separate ScrollView. Reply previews use a message map. Message rows include activity bot and jump-scroll handling.
Message bubble action wiring
apps/mobile/app/thread.tsx
MessageBubble now uses memo. Answer and speak callbacks receive the associated message.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 89355

This change virtualizes mobile chat transcripts and preserves existing message actions and thread behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: elie222, cursoragent, bnsd55

Sequence Diagram(s)

sequenceDiagram
  participant ThreadScreen
  participant FlatList
  participant pinnedScroll
  participant MessageBubble
  ThreadScreen->>FlatList: render reversed messages
  FlatList->>MessageBubble: render each message
  ThreadScreen->>pinnedScroll: render selected pinned page
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: improving responsiveness for live mobile chats through virtualization, memoization, and stabilized handlers.
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

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.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR improves mobile chat responsiveness while preserving exact search-result navigation.

  • Virtualizes active transcripts with an inverted FlatList.
  • Retains a bounded ScrollView for search-around pages and keeps it mounted while earlier history loads.
  • Memoizes message bubbles and stabilizes message action callbacks.
  • Replaces repeated reply-message scans with a lookup map.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/mobile/app/thread.tsx Adds transcript virtualization and memoized message rendering while preserving the pinned search page across history-loading outcomes.

Reviews (3): Last reviewed commit: "merge(main): resolve thread.tsx conflict..." | Re-trigger Greptile

Comment thread apps/mobile/app/thread.tsx Outdated
@luinbytes

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

Playwright screenshots

Open screenshot gallery · Dashboard · CI run

Updated for commit 89355b1.

Keep inverted FlatList virtualization for live chats and ScrollView
search jumps, preserve the load-earlier search-pin fix, and retain
KeyboardAvoidingView / scroll / working-agent parity from elie222#387.

Co-authored-by: Elie Steinbock <elie222@users.noreply.github.com>
@elie222
elie222 merged commit 0671907 into elie222:main Aug 30, 2026
14 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.

3 participants