Skip to content

fix(mobile): open a chat already at the latest message - #2514

Merged
DoodleBears merged 1 commit into
mainfrom
claude/project-thread-0gk1bi
Oct 21, 2026
Merged

DoodleBears merged 1 commit into
mainfrom
claude/project-thread-0gk1bi

Conversation

@DoodleBears

Copy link
Copy Markdown
Contributor

Reported by Vain on iOS: opening a chat seemed to start partway up, maybe at the unread position, then visibly scroll all the way to the bottom, possibly loading more history on the way.

Why the change

A chat should open already showing its latest message. Instead it visibly scrolls down to the bottom after opening, and can trigger load-more along the way.

Issue / Discussion: Refs #1845

Special things to note

  • Intended behavior: an ordinary chat opens at the latest message. There is no "open at unread" logic. Only a search result (focus) opens at a specific message. The list stays hidden (opacity: 0) until useFollowLatest has pinned the end and the content has settled.
  • Cause (inferred from code):
    • The list is top-to-bottom since feat(mobile): native chat header with a top-to-bottom message list #2344.
    • FlatList renders the first 10 rows, then adds batches about 50 ms (~3 frames) apart. Every content-size change pins the list to the end again.
    • confirm revealed the list after a single frame without a size change, which often falls between two batches. The list became visible mid-layout and then visibly chased the end as the remaining batches arrived.
    • onStartReached was enabled as soon as the list was revealed. If it was revealed while few rows had rendered, the list was near its start and loaded older history on its own.
    • This is shared code, so Android behaves the same way.
  • Fix:
    • Reveal only after STABLE_FRAMES (6) consecutive frames with no size change. The safety cap SETTLE_FRAMES is raised from 12 to 45 frames, so a busy chat still shows within about 0.75 s.
    • onStartReached only loads older history after the Human has dragged the list (browsed). Search focus still loads older pages through its own path.
  • Merge risk: low. On open, the list stays hidden about 100 ms longer, and load-more waits for a drag.
  • Verification:
    • vitest apps/mobile: 1038 passed, 9 skipped, including new cases for batch-rendered rows and drag-gated load-more. The test frame flush allows more rounds now.
    • apps/mobile tsc and pnpm lint pass.
    • Not run: the Simulator or device check. It rides the next combined batch, per the batch-then-test rule.

Change outline

  • confirm(version) used to reveal after 1 stable frame. It now reveals after 6 stable frames, or after 45 frames at most.
  • onStartReached used to be enabled when ready. It is now enabled when ready && browsed.

Generated by Claude Code

The list was revealed after one frame without a size change, but
FlatList renders rows in batches about three frames apart, so it often
showed mid-layout and visibly chased the end. It now waits for several
stable frames, and older history loads only after the Human drags.

Refs #1845

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U22S26HTx4etvoWKCpeMnQ
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 652ecb4f-f44b-4d3f-9a0f-b337973923c2
📥 Commits

Reviewing files that changed from the base of the PR and between 7279450 and 8b3c277.

📒 Files selected for processing: 4
  • apps/mobile/src/ui/chat/conversation-screen.tsx
  • apps/mobile/src/ui/chat/follow-latest.ts
  • apps/mobile/test/follow-latest-gestures.test.tsx
  • changes/1845-open-chat-settle.md
  • Autofix · 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.

@DoodleBears
DoodleBears merged commit 50df2a3 into main Oct 21, 2026
10 checks passed
@DoodleBears
DoodleBears deleted the claude/project-thread-0gk1bi branch October 28, 2026 04:24
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.

2 participants