Skip to content

fix(web): restore the scroll position when returning to a thread - #56

Closed
macodev00 wants to merge 1 commit into
mainfrom
cursor/restore-thread-scroll-position-379e
Closed

macodev00 wants to merge 1 commit into
mainfrom
cursor/restore-thread-scroll-position-379e

Conversation

@macodev00

@macodev00 macodev00 commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes pingdotgg#14051

What Changed

Returning to a thread now restores the end when live follow was still on. MessagesTimeline stores atEnd as the geometric end, or as the end while live follow is enabled, ChatView's follow latch is still held, and the list is not holding anchored end space. A gesture that releases the latch stores the real offset on that same scroll.

Why

handleScroll runs for layout movement, including row measurement and the frame after rows changes. A row taller than its 90px estimate, or a composer footer that grows without re-pinning, can leave the viewport more than 40px short of the content while the user is still at the latest message. That gap was saved as a reading position. The next visit turned live follow off, showed "Scroll to end", and restored the saved row or offset.

ChatView already ignores that gap for the pill while the follow latch is held. The remembered position now uses the same latch. Anchored end space is excluded so a first send held near the top is not stored as the end.

Desktop uses this timeline. Mobile does not cache a timeline position here.

UI Changes

No new controls. A thread left at the bottom opens at the bottom again, without "Scroll to end". A thread left mid-list still restores that offset.

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
Open in Web Open in Cursor 

Layout scrolls were saved as a reading position while live follow was still on, so a long thread left at the bottom reopened mid-list with Scroll to end. A latched follow is now remembered at the end, and a gesture that releases the latch stores the real offset.

Fixes pingdotgg#14051

Co-authored-by: maco <macodev00@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Sep 28, 2026
@macodev00

Copy link
Copy Markdown
Owner Author

Opened upstream.

@macodev00 macodev00 closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 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]: Returning to a long thread lands at the top or the middle instead of where I left it

1 participant