Skip to content

fix(web): correct thread scroll-to-bottom pill behavior#2120

Open
UtkarshUsername wants to merge 35 commits intopingdotgg:mainfrom
UtkarshUsername:fix/thread-open-scroll-pill
Open

fix(web): correct thread scroll-to-bottom pill behavior#2120
UtkarshUsername wants to merge 35 commits intopingdotgg:mainfrom
UtkarshUsername:fix/thread-open-scroll-pill

Conversation

@UtkarshUsername
Copy link
Copy Markdown
Contributor

@UtkarshUsername UtkarshUsername commented Apr 17, 2026

Fixes #2119

What Changed

Fixes the pill showing when opening an existing thread that is already at the bottom

Why

When a thread is opened, the "Scroll to bottom" button was always shown even when the chat is at the bottom. Clicking it did nothing.

UI Changes

Before:

scroll-before.mp4

After:

scroll-after.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Low risk UI-behavior change limited to client-side scroll state tracking and a new initial snap-to-bottom path, with added tests to guard regressions.

Overview
Fixes the scroll-to-bottom pill incorrectly appearing when opening an already-bottomed thread by tracking programmatic scrolls and suppressing transient isAtEnd updates while those scrolls are in flight.

MessagesTimeline now performs a RAF-scheduled initial scrollToEnd when rows first appear (and reschedules if rows change before the frame runs), and derives isAtEnd directly from scroll event metrics when available. ChatView centralizes scroll-to-end behavior via beginProgrammaticScroll/scrollToEnd, clears pending state on thread switch/unmount, and updates optimistic-send flows to use the new helper.

Reviewed by Cursor Bugbot for commit be1a2de. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix scroll-to-bottom pill visibility during programmatic scrolls in thread view

  • Introduces programmatic scroll tracking in ChatView so that onIsAtEnd changes are suppressed while a programmatic scroll is in flight, preventing the scroll-to-bottom pill from flashing during initial thread load or explicit scroll-to-end actions.
  • Replaces the previous initial scroll logic in MessagesTimeline with a RAF-based snap-to-bottom on mount, rescheduled if rows change before the frame runs.
  • Adds a deriveIsAtEndFromScrollEvent helper to compute at-end status from native scroll event metrics (within 2px threshold), reducing reliance on LegendList state queries.
  • Clears pending programmatic scroll state on thread switch and component unmount.
  • Behavioral Change: optimistic message insertion now calls scrollToEnd(false) before updating, replacing direct isAtEndRef/UI resets.

Macroscope summarized be1a2de.


Open in Devin Review

- Reconcile opened threads to the bottom before rendering optimistic messages
- Keep the scroll-to-bottom pill suppressed during initial settle
- Add coverage for opening a populated thread
- Remove redundant stick-to-bottom wiring
- Derive end-of-list state from scroll events during timeline mount
- Keep the scroll-to-bottom pill hidden while new threads settle
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bac218da-e070-41c9-815b-2d6631390f9a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 17, 2026
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
@UtkarshUsername UtkarshUsername marked this pull request as draft April 17, 2026 12:54
- Retry the initial bottom snap when rows change before the first animation frame
- Clear the scroll-to-bottom pill when jumping to the end
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 17, 2026

Approvability

Verdict: Approved

Self-contained UI bug fix for scroll-to-bottom pill behavior in chat threads. Changes add tracking for programmatic scrolls to prevent the pill from incorrectly appearing during automated scroll operations. Includes comprehensive tests and touches no sensitive areas.

You can customize Macroscope's approvability policy. Learn more.

- Suppress the scroll-to-bottom pill during programmatic initial scrolls
- Add a callback so timeline and chat view share the same scroll state
- Preserve the scrollToEnd call result when opening a thread
- Keeps programmatic scroll handling aligned with the list API
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 17, 2026
- Clear the scroll-to-bottom pill immediately before adding optimistic messages
- Keep thread sends pinned to the live end during the pre-send scroll
@UtkarshUsername UtkarshUsername marked this pull request as ready for review April 17, 2026 13:33
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 17, 2026
- Make RAF mocking return unique ids
- Wait for the first frame before rerendering so the cancel/reschedule path is asserted reliably
@macroscopeapp macroscopeapp Bot dismissed their stale review April 17, 2026 13:44

Dismissing prior approval to re-evaluate 6732004

Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/components/ChatView.tsx
- Update initial chat timeline scroll ordering
- Keep the scroll pill state in sync during programmatic scroll
- Rely on `scrollToEnd(false)` to clear the scroll-to-bottom state
- Simplify optimistic message flow in chat thread sends
- Track scheduled animation frames explicitly
- Verify the rescheduled snap fires once and preserves end-state
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
- Accept the current animation-frame behavior when opening a thread
- Remove the cancelled-frame expectation
- Add a fallback timeout to clear pending programmatic scroll state
- Keep the scroll-to-bottom pill accurate when threads open or reconcile
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 17, 2026
Comment thread apps/web/src/components/ChatView.tsx Outdated
UtkarshUsername and others added 2 commits April 18, 2026 00:47
- Stop clearing pending programmatic scroll state
- Keep the scroll-to-bottom pill behavior stable
@macroscopeapp macroscopeapp Bot dismissed their stale review April 17, 2026 19:57

Dismissing prior approval to re-evaluate 245349f

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 245349f. Configure here.

Comment thread apps/web/src/components/ChatView.tsx Outdated
- Reset programmatic scroll state on active thread changes
- Prevent stale open-thread scroll UI from carrying over
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: scroll-to-bottom pill appears after navigating to a new thread

1 participant