Skip to content

Render only the visible rows of long viewer lists with VirtualList - #481

Merged
benschac merged 1 commit into
mainfrom
viewer/virtual-lists
Dec 1, 2026
Merged

benschac merged 1 commit into
mainfrom
viewer/virtual-lists

Conversation

@benschac

@benschac benschac commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Renders three long viewer lists through @effect/ui-kit's VirtualList, already in the pinned Effect UI build (87a704b), so only the rows near the visible part are in the page:

  • Session turns (apps/viewer/src/view/sessionView.ts): sessions can have hundreds to thousands of turns, each rendering markdown. The list is keyed by turn ID and scrolls with the session pane (scrollContainer: "nearest").
  • Task events in the detail drawer (apps/viewer/src/view/detailView.ts).
  • Revision history (apps/viewer/src/hosted/view/historyView.ts), one list per kind.

Jumping to a turn can no longer look up its element, which may not be rendered. A hunk's mark or a link now records the turn in the model, and the list scrolls to it with scrollTo by key. ScrollTurn and the link's turn scroll target are removed.

Tests

  • A long session, a long history and a task with many events each put only a window of rows in the page. Each test fails with initialCount: 10_000, which renders every row.
  • A turn far down a session is rendered once a hunk's mark asks for it. The test fails without scrollTo.
  • The history property now checks aria-setsize for the full count instead of a link for every revision.

Not covered

  • Scene tests do no layout, so measuring and scrolling were not checked here in a browser. Codex's review drove it in Chromium; see Keep turn rows keyed and scroll requests distinct in the virtual lists #482.
  • The revision API (fetchRevisions) still returns every revision. Paging it is separate work.
  • test/demo.test.ts fails three tests on main too (CI has been red since "bump manifest"). Unrelated.

Review by Codex

Round 1 found four problems, all fixed in #482: rows not keyed by turn ID, scroll request IDs reset on link navigation, an old turn scroll replayed when the code view reopened, and ordered-list numbers restarting at 1.

🤖 Generated with Claude Code

The session pane's turns, a task's events in the detail drawer and a PRD's
revision history now render through @effect/ui-kit's VirtualList, so a long
session or history puts only the rows near the visible part in the page.

The session list scrolls to a turn itself. A hunk's mark or a link records
a TurnScroll request in the model, which the list passes as scrollTo by the
turn's key, so a turn that is not yet in the page is rendered and scrolled
to. ScrollTurn and the link's turn scroll target go, since both looked for
an element that may no longer exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

benschac commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner Author

benschac commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner Author

Merge activity

  • Dec 1, 5:00 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 1, 5:01 PM UTC: @benschac merged this pull request with Graphite.

@benschac
benschac merged commit 258a6c7 into main Dec 1, 2026
2 of 3 checks passed
benschac added a commit that referenced this pull request Dec 1, 2026
Review of #481 found four problems the virtualized lists brought in:

- Session rows were not keyed by turn ID, so a focused tool button could
  move to another turn when the rendered window changed.
- Clearing the turn scroll on a link reset its request ID to 1, which a
  list still in the page ignored. The request count is now its own field,
  turnScrollRequest, and is never reset.
- A turn asked for in one visit to the code view was scrolled to again
  when the code view opened later. Opening the code view clears the ask.
- Ordered lists renumbered from 1 as rows left the page. Event and
  revision rows now carry their place in the whole list as value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
benschac added a commit that referenced this pull request Dec 1, 2026
Review of #481 found four problems the virtualized lists brought in:

- Session rows were not keyed by turn ID, so a focused tool button could
  move to another turn when the rendered window changed.
- Clearing the turn scroll on a link reset its request ID to 1, which a
  list still in the page ignored. The request count is now its own field,
  turnScrollRequest, and is never reset.
- A turn asked for in one visit to the code view was scrolled to again
  when the code view opened later. Opening the code view clears the ask.
- Ordered lists renumbered from 1 as rows left the page. Event and
  revision rows now carry their place in the whole list as value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant