Skip to content

fix(chat): remember latest intent before switching lenses - #1346

Open
Yoonwoo-Ha wants to merge 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/chat-latest-intent
Open

Yoonwoo-Ha wants to merge 1 commit into
devswha:mainfrom
Yoonwoo-Ha:fix/chat-latest-intent

Conversation

@Yoonwoo-Ha

Copy link
Copy Markdown
Contributor

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.

  • 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.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5052ac2-f804-4dda-8590-326a370c1ba9
📥 Commits

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.
Cover view-switch restoration
scripts/composer-fit-demo-regression.ts
The regression script adds a conversation-freeze option and tests position, draft, and latest-position restoration across chat and terminal view changes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to 1ba1e

No merge-blocking issue was established for the chat position change. It is ready for normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately describes the primary change: preserving latest-position intent before switching chat lenses.
Description check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants