Skip to content

fix: debouncing mobile scroll to bottom#51

Merged
sirily11 merged 1 commit into
mainfrom
mobile
May 23, 2026
Merged

fix: debouncing mobile scroll to bottom#51
sirily11 merged 1 commit into
mainfrom
mobile

Conversation

@sirily11

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 23, 2026 04:03
@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
rxcode Ready Ready Preview, Comment May 23, 2026 4:03am

Request Review

@sirily11 sirily11 merged commit 6fc9481 into main May 23, 2026
11 checks passed
@sirily11 sirily11 deleted the mobile branch May 23, 2026 04:03
@autopilot-project-manager autopilot-project-manager Bot added the bug Something isn't working label May 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce jittery/over-frequent “scroll to bottom” behavior in the mobile chat UI by debouncing automatic bottom-follow during streaming updates, and it also refactors desktop-side mobile branch-op handling to keep mobilePendingWorktrees in sync in both branch operations.

Changes:

  • Add a debounced auto-scroll mechanism for mobile chat bottom-follow during streaming/layout-driven updates.
  • Cancel any pending debounced auto-scroll when the user sends a message, pins to top, or taps the “scroll to bottom” button.
  • Refactor pending-worktree bookkeeping into a shared helper and apply it to both “switch existing” and “create new” mobile branch operations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
RxCodeMobile/Views/MobileChatView.swift Introduces debounced auto-scroll task/state to coalesce repeated scroll-to-bottom triggers.
RxCode/App/AppState+MobileSync.swift Refactors and unifies pending worktree update/removal after mobile branch operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1096 to +1106
autoBottomScrollTask = Task { @MainActor in
if delay > 0 {
try? await Task.sleep(nanoseconds: UInt64(delay * 1_000_000_000))
}
guard !Task.isCancelled else { return }
autoBottomScrollTask = nil
guard didEstablishInitialScroll,
autoScrollEnabled,
!isUserDragging,
!isPinningLatestTurnToTop
else { return }
/// user actions and initial thread positioning still scroll immediately.
private func scrollToBottomDebounced(proxy: ScrollViewProxy, reason: String) {
guard autoBottomScrollTask == nil else { return }
let elapsed = Date().timeIntervalSince(lastAutoBottomScrollDate)
@sirily11

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants