Skip to content

fix(web): restore thread scroll position - #10340

Draft
harshiempire wants to merge 1 commit into
pingdotgg:mainfrom
harshiempire:fix/persist-thread-scroll-position
Draft

fix(web): restore thread scroll position#10340
harshiempire wants to merge 1 commit into
pingdotgg:mainfrom
harshiempire:fix/persist-thread-scroll-position

Conversation

@harshiempire

@harshiempire harshiempire commented Sep 6, 2026

Copy link
Copy Markdown

What Changed

Switching away from a thread and back now returns the chat timeline to where you were reading, instead of jumping to the latest message. Positions are kept per client session in a small bounded in-memory cache keyed by thread. A thread you left at the bottom keeps following new content as before; only a thread you had scrolled up in is restored.

Scope decisions:

  • Web and desktop only. Mobile has its own timeline and is consciously not covered.
  • Nothing is persisted across restarts or synced between devices.
  • Citation positioning still takes priority over a saved position.

Why

Glancing at another thread and losing your place in a long conversation is a constant small annoyance when driving several agents. Provenance: #6195 (transcript half; the open-file half is #9874).

The saved offset is written once per animation frame while scrolling and cleared when the reader reaches the end, so following live output costs nothing extra.

UI Changes

Video: scroll up in a thread, switch to another thread, switch back. (attached below)

Checklist

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

Written with Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

Note

Restore per-thread scroll position in MessagesTimeline

  • Adds timelineScrollState.ts module with a bounded LRU cache (200 entries) to store numeric scroll offsets per thread key.
  • MessagesTimeline.tsx reads the saved offset on mount, disables end-follow during restoration, and saves or clears the offset on scroll and cleanup.
  • ChatView.tsx starts routed threads in free-scrolling mode when a saved position exists.
  • Adds delete method to lruCache.ts to support removing individual cached entries.
  • Risk: ChatView timeline initialization switches from end-following to free-scrolling for threads with a saved non-end position.

Macroscope summarized 73cd51e.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 6, 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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant