perf(app): virtualize session timeline rows#26949
Open
Hona wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves session timeline render performance in the app by upgrading virtua and switching the session timeline rendering model to virtualize at “timeline row” granularity (user message row, assistant part rows, thinking/retry/error rows, diff summaries, etc.) rather than rendering full turns.
Changes:
- Upgrade
virtuaand refactor the session timeline to produce a flattened list of keyedTimelineRows rendered viaVirtualizer. - Add timeline-part ID data attributes and export part-grouping utilities from
@opencode-ai/ui/message-partto support row-level virtualization and anchoring. - Defer default-open tool body mounting in
BasicToolto reduce first-paint cost.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/src/components/message-part.tsx | Exports part grouping helpers/types and adds timeline-part data attributes used for row virtualization/anchoring. |
| packages/ui/src/components/basic-tool.tsx | Defers mounting heavy tool bodies (including default-open) using a global deferred mount queue. |
| packages/ui/package.json | Exposes ./session-diff as a package export for app-side use. |
| packages/app/src/pages/session/use-session-hash-scroll.ts | Integrates “reveal” hook so hash scrolling can work with virtualization. |
| packages/app/src/pages/session/message-timeline.tsx | Major refactor: builds flattened timeline rows and renders them through virtua Virtualizer, including diff summaries and turn status rows. |
| packages/app/src/pages/session.tsx | Replaces “history window” logic with a history loader that coordinates prepend + virtualization shift, and wires reveal callback into hash scrolling. |
| package.json | Bumps virtua version to 0.49.1. |
| bun.lock | Lockfile update for virtua@0.49.1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+127
to
131
| cancelShiftReset() | ||
| setState("shift", true) | ||
|
|
||
| while (true) { | ||
| await input.loadMore(id) |
Comment on lines
+982
to
+986
| part={part} | ||
| message={message} | ||
| showAssistantCopyPartID={assistantCopyPartID(row.userMessageID)} | ||
| turnDurationMs={turnDurationMs(row.userMessageID)} | ||
| defaultOpen={partDefaultOpen(part, settings.general.shellToolPartsExpanded(), settings.general.editToolPartsExpanded())} |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Validation
Notes