You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(chat): remember latest intent before switching lenses - #1346
Choosing Jump to latest expresses bottom-follow immediately, but LegendList can defer the actual scroll. Switching to Terminal in that gap unmounts Chat before a scroll event stores the new intent, so returning can restore the older reading position.
Update bottom-follow state and remember atEnd: true synchronously before requesting the list scroll.
While following the end, store the end marker without scanning row rectangles or resolving a turn anchor. Readers away from the end retain the existing anchor-and-offset restoration.
Add an independent idle regression at 390px and 1440px: preserve a reader's paragraph and one-line unsent draft across a lens round trip, then choose Jump to latest and switch to Terminal in the same task; both the first and repeated return must land at the end.
Freeze only the case's unsolicited demo completion. A compact viewport provides enough natural history without depending on multiline composer sizing or toggling tool disclosures.
Design reference: T3 Code's timeline position memory distinguishes following the end from free scrolling and stores live-follow intent in the remembered position. This keeps herdr's existing model and records that intent before its deferred scroll. No external implementation was copied for this fix.
This is an independent PR from upstream main, not stacked on the composer autosizing fix. It does not claim to solve arbitrary upward restoration in long active/reasoning-heavy tabs. It adds no setting and does not include the proposed as-shown clipboard feature.
Validation
Linux x64, Bun 1.4.2, Chrome 155; isolated worktree based on upstream b5cdbdb.
bun run check fast: passed — workflow syntax, generated types/themes, typecheck, production build, and 4,461 unit tests passed / 0 failed / 8 skipped.
After finalizing the independent browser fixture, reran typecheck and the full CHROME_PATH=/opt/google/chrome/chrome bun scripts/composer-fit-demo-regression.ts: passed. Production code did not change after Fast checks.
Separate production-build browser smoke at 390px and 1440px: a 150px reading gap was restored, same-task Jump-to-latest → Terminal → Chat returned with a 0px bottom gap, and remembering the chosen end performed zero row scans. No browser errors.
Full integration suite and native Windows validation were not run locally; fork CI requires maintainer approval.
Reviewing files that changed from the base of the PR and between b5cdbdb and 1ba1eed.
📒 Files selected for processing: 3
changelog.d/chat-latest-lens-return.md
scripts/composer-fit-demo-regression.ts
src/components/ChatView.tsx
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
Choosing Jump to latest now preserves your latest-position preference when switching to Terminal and back to Chat, even if scrolling hasn’t finished.
When you’re reading earlier messages, returning to Chat continues to restore your reading position.
ChatView now saves an explicit end position when following and updates follow state before saving and scrolling. Regression tests cover paragraph position, unsent drafts, and latest-position restoration when switching between chat and terminal.
Changes: Chat position restoration
Layer / File(s)
Summary
Save latest-position intent src/components/ChatView.tsx, changelog.d/chat-latest-lens-return.md
ChatView saves an explicit end position when following and sets follow state before saving and scrolling. The changelog describes this behavior and the existing restoration for readers away from the end.
The regression script adds a conversation-freeze option and tests position, draft, and latest-position restoration across chat and terminal view changes.
No merge-blocking issue was established for the chat position change. It is ready for normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title is concise, specific, and accurately describes the primary change: preserving latest-position intent before switching chat lenses.
Description check
The description includes the required Change and Validation sections. It clearly explains the problem, resulting behavior, implementation scope, regression coverage, test results, and known validation…
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description includes the required Change and Validation sections. It clearly explains the problem, resulting behavior, implementation scope, regression coverage, test results, and known validation limits.
Full details: Docstring Coverage
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
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.
Comment @coderabbitai help to get the list of available commands.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Choosing Jump to latest expresses bottom-follow immediately, but LegendList can defer the actual scroll. Switching to Terminal in that gap unmounts Chat before a scroll event stores the new intent, so returning can restore the older reading position.
atEnd: truesynchronously before requesting the list scroll.Design reference: T3 Code's timeline position memory distinguishes following the end from free scrolling and stores live-follow intent in the remembered position. This keeps herdr's existing model and records that intent before its deferred scroll. No external implementation was copied for this fix.
This is an independent PR from upstream main, not stacked on the composer autosizing fix. It does not claim to solve arbitrary upward restoration in long active/reasoning-heavy tabs. It adds no setting and does not include the proposed as-shown clipboard feature.
Validation
Linux x64, Bun 1.4.2, Chrome 155; isolated worktree based on upstream
b5cdbdb.bun run check fast: passed — workflow syntax, generated types/themes, typecheck, production build, and 4,461 unit tests passed / 0 failed / 8 skipped.CHROME_PATH=/opt/google/chrome/chrome bun scripts/composer-fit-demo-regression.ts: passed. Production code did not change after Fast checks.