Skip to content

Fix chat timeline row height estimation#1093

Open
huxcrux wants to merge 7 commits intopingdotgg:mainfrom
huxcrux:t3code/fix-chat-timeline-row-estimation
Open

Fix chat timeline row height estimation#1093
huxcrux wants to merge 7 commits intopingdotgg:mainfrom
huxcrux:t3code/fix-chat-timeline-row-estimation

Conversation

@huxcrux
Copy link
Contributor

@huxcrux huxcrux commented Mar 14, 2026

What Changed

Improved chat timeline virtualization height estimation by switching from coarse message-only estimates to row-aware estimates for user messages, assistant messages, work groups, proposed plan cards, and the working indicator.

Assistant row estimates now also account for markdown structure and changed-files summaries, while proposed plans and work groups use estimators closer to their actual rendered shape.

Fixes: #1035

This PR supersedes #1054.

Why

Some chat rows were being underestimated, which could cause overlapping content and visible scroll instability in virtualized threads.

UI Changes

Same as Why ^

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

Fix chat timeline row height estimation across message, work, and proposed-plan rows

  • Introduces estimateTimelineRowHeight in timelineHeight.ts as a unified estimator replacing the previous per-message approach, covering work groups, proposed plans, working rows, and messages.
  • Assistant message height now accounts for markdown structure (headings, lists, tables, fenced code blocks) via estimateAssistantMarkdownStructureBonusPx and text normalization before line-wrapping.
  • Proposed plan rows get dynamic height based on collapsibility (size/line count), collapsed preview markdown, and a max collapsed preview height cap.
  • Work row heights reflect entry visibility (overflow truncation vs. expansion), optional group header, and per-entry changed-file chip rows.
  • Adds resolveMessagesTimelineRows in MessagesTimeline.logic.ts to produce typed MessagesTimelineRow objects; MessagesTimeline.tsx uses these for virtualizer size estimation and rendering.
  • Adds a browser test suite in MessagesTimeline.browser.tsx that measures actual rendered row heights and asserts parity with the estimator across desktop/mobile viewports and expand/collapse interactions.

Macroscope summarized 48a41c6.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 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: 89022388-ab46-44da-b2d4-c23936104f94

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
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 14, 2026
@juliusmarminge
Copy link
Member

needs tests. also I think the estimation of changed files tree also need to be fixed

@github-actions github-actions bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Mar 16, 2026
@huxcrux huxcrux force-pushed the t3code/fix-chat-timeline-row-estimation branch from 3da112a to 308e1bb Compare March 16, 2026 20:52
@huxcrux huxcrux force-pushed the t3code/fix-chat-timeline-row-estimation branch from 308e1bb to 48a41c6 Compare March 16, 2026 21:01
@huxcrux
Copy link
Contributor Author

huxcrux commented Mar 16, 2026

needs tests. also I think the estimation of changed files tree also need to be fixed

I added tests both unit and a browser render test. Let me know in case the browser test was a bit much and i can drop it.

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

Labels

size:XXL 1,000+ 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.

Chat timeline content overlaps (assistant text + tool call cards stack on top of each other)

2 participants