Repository navigation
Description
Problem Statement
Agent transcripts grow without bound. Context compaction removes the natural cap on session length (a session continues across many context windows), and increasingly autonomous agents run long tool-heavy tasks. ChatMessageList renders the full history in plain DOM flow — by design, and it's the right default: native selection, find-in-page, and scroll anchoring are why we build on it. But there is no documented scaling envelope and no sanctioned mitigation path when transcripts get long. Builders of AI transcript UIs hit two walls with no first-party answer: session-switch mount latency, and live-resize reflow cost.
Evidence of Demand
Measured on a production astryx-based AI desktop client, with a reproducible single-file harness (same astryx Markdown components in both arms; corpus calibrated from 182 real agent sessions — 70% folded tool groups, 5-7% code fences, 6-13% tables):
- Memory and mount scale linearly, ~27 KB per rendered item: 1k items ≈ 54 MB / 0.95 s mount; 5k ≈ 162 MB / 2.7 s; 20k ≈ 566 MB / 12.8 s mount, 15.8 s to stable bottom.
- Live-resize reflow: 16 fps at 2k items (a virtualized reference runs 60 fps on the same corpus).
- Anchoring is ChatLayout's win: zero drift during width reflow while scrolled up (native anchoring), where compensation-based virtualizers needed years of fixes.
- Today's workloads mostly fit: across 182 real sessions, tool-call folding absorbs 77% of lines and every session lands ≤3.4k rendered items. But the largest sessions were compacted 12-22× — transcript length is already decoupled from context limits, and agent autonomy keeps shifting the distribution right.
- Industry signal: claude.ai's transcript is virtualized today (TanStack Virtual; migrating to an in-house document-flow virtualizer as of Aug 2026 — see comments); Codex ships a custom bottom-anchored virtualizer; react-virtuoso monetized its AI MessageList (license: Commercial).
No design system ships a chat-capable virtualizer — Spectrum/antd/Fluent/Prime virtualize tables and option lists only.Update Aug 2026: Adobe now ships a virtualized chat Thread in@react-spectrum/ai(see comments); antd (Ant Design X), IBM Carbon (@carbon/ai-chat), and AWS Cloudscape ship chat components without transcript virtualization; Fluent/Prime still virtualize tables and option lists only.
Why Existing Components Don't Cover This
ChatMessageListrenders all children; there is no windowed-data or load-earlier affordance.- Fixing it from outside breaks: per-row
content-visibility: autowith naive estimates measured 3× worse mount at 5k and a renderer freeze at 20k — c-v needs coordinated intrinsic-size estimates and near-viewport exemptions that a consumer can't supply cleanly from outside the list. - Rolling your own virtualization around ChatLayout means two writers to the same scroll position (app-side follow vs. the list's size compensation). This is workable — production AI clients do it — but invites subtle, hard-to-reproduce artifacts; a first-party answer can coordinate the two.
Rough Approaches Considered
Option A — data-layer affordance: first-party "load earlier" / windowed-data support on ChatMessageList. Keeps plain DOM flow and all native semantics; matches the production pattern Claude Desktop uses for large sessions (lazy history + spinner).
Option B — opt-in plugin, per the Table precedent (#3639 / #3942): useChatVirtualization, core stays non-virtualized. Source-level study of TanStack Virtual, LegendList (web), and virtua surfaced three design considerations: coordinating follow with size compensation inside the list closes off a class of intermittent artifacts (LegendList's state machine; TanStack's followOnAppend); a component-owned container eliminates the clamp-race class (virtua); and anchorTo/followOnAppend is production-proven API vocabulary (TanStack, used by claude.ai). Dependency posture can follow the plugin model: the plugin package carries any external dep; core stays zero-dep.
Non-goal: virtualizing core ChatMessageList by default — it would trade away find-in-page, selection, and native anchoring, which are the reasons to choose astryx Chat.
Accessibility Considerations
The non-virtualized default is the accessibility feature: the full transcript stays in the accessibility tree, and find-in-page, select-across-messages, and native scroll anchoring all work. ChatMessageList maps to the ARIA log pattern (role="log", polite live announcements on append).
Each option must preserve this bar:
- Option A: focus stays on the trigger after prepend; the viewport must not jump (visible-content position maintained).
- Option B: off-screen rows leave the AT tree, so the plugin must supply position context (
aria-setsize/aria-posinsetoraria-rowcount), retain focus when a focused row unmounts, and keep Home/End/PageUp/PageDown working across unrendered ranges. React Spectrum's Virtualizer is prior art for a11y-correct virtualization. Find-in-page and select-all remain fundamentally degraded under virtualization — which is why it stays opt-in.
Performance Considerations
Measured with a reproducible harness (real-mix corpus as above; dual sampling — pre-paint rAF + post-paint — so only user-visible artifacts are counted; memory via performance.measureUserAgentSpecificMemory under cross-origin isolation):
- Today: N items ≈ 48N DOM nodes, ~27 KB/item, linear. 1k ≈ 54 MB / 0.95 s mount; 5k ≈ 162 MB / 2.7 s; 20k ≈ 566 MB / 12.8 s. Live-resize: 16 fps at 2k items.
- Option A: nodes bounded by window size W (≈48W); full native semantics retained.
- Option B: O(viewport) — a few hundred nodes at any N; the virtualized reference held 60 fps resize and zero anchor drift on the same corpus.
- Anti-pattern, measured: naive per-row
content-visibility: auto(coarse estimates) was 3× worse at 5k mount and froze the renderer at 20k — motivating a coordinated first-party implementation rather than consumer-side CSS.
Pre-submission Checklist
- I have read the Contributing guide
- I have read the API Conventions
- I have checked that existing Astryx components cannot compose to solve this
- This is a general-purpose UI pattern (not specific to one product)
Activity
yyq1025 commentedon Aug 20, 2026
Update (Aug 2026): a design system shipped a chat virtualizer, claude.ai is replacing TanStack, and same-corpus scroll benchmarks
Four developments since filing materially update the Industry Signal and Option B sections. Measurements below use the same harness and real-mix corpus as the RFC (dual pre-paint/painted sampling, real Chrome).
1. A design system now ships a chat-capable virtualizer. Adobe's
@react-spectrum/ai0.2.0 ships a virtualizedChat/Threadbuilt on the React Aria Virtualizer: a scroll-anchoring engine landed in the headless layer (react-stately'sScrollAnchorplus anUNSTABLE_getScrollAnchorInfo()layout contract), and a chatListLayoutwithanchorTo: 'end'+scrollEndThreshold— while near the end, appends and streaming size changes keep the viewport pinned. Notable a11y decisions: rows are built newest-first in the DOM for screen readers;isStreamingdefers live announcements to stream end (per-token announcements keep resetting SR reading); focus returns to the newest row after scroll-to-bottom. Source TODOs state Thread is intended to move into react-aria-components. This revises the RFC's "no design system ships a chat-capable virtualizer" claim (body updated with a pointer here) — notably, it lands amid a 2025–26 wave of design-system chat offerings (Ant Design X'sBubble.List, IBM's@carbon/ai-chat, Cloudscape's genAI chat patterns, Vercel's AI Elements), and Spectrum's is the only virtualized one; the rest render the full transcript and lean on memoization or auto-scroll alone. It is also direct precedent for Option B's shape: engine in a lower layer, chat component opt-in, core untouched. TheanchorTovocabulary the RFC called production-proven now appears in a second, independent production implementation.2. claude.ai is migrating off TanStack Virtual to an in-house virtualizer. The current desktop bundle runs a feature-gated dual stack: the new implementation is spacer-based with rows in normal document flow (not absolute positioning), identity-keyed anchoring, directional overscan, a pin-to-bottom state machine — and, notably for this RFC, a custom find-in-page provider, i.e. virtualization's find-in-page regression was expensive enough that they rebuilt it as a bespoke subsystem. This lands after the same team upstreamed anchoring fixes to TanStack in June. It strengthens the RFC's premise from both directions: the native semantics
ChatMessageListpreserves for free are worth a dedicated subsystem to a first-party team, and compensation-based virtualization was ultimately replaced rather than patched.3. Same-corpus scroll benchmarks separate the libraries on a new axis. Streaming follow-at-bottom is effectively solved in both libraries measured: TanStack
react-virtual3.14.10 at 0.5% painted-jitter frames, LegendList web 3.3.x at 1.5% — both imperceptible. The discriminating axis is scrolling up into cold, unmeasured history: TanStack showed 14–23% painted frames with 155–347 px of anchor motion (better size estimates halve the magnitude but not the frequency — compensation events are inherent to estimate-then-measure), while LegendList web measured 0–0.1%, indistinguishable from the non-virtualized control arm. A third axis surfaced during the in-house-virtualizer rollout above: a long programmatic jump (scroll-to-bottom button) can land on an empty spacer and blank-flash until rows mount and measure. The known mitigation is a "committed" scroll-to-end that renders the destination before positioning (LegendList ships this since 3.0.4). Suggested acceptance criteria for Option B: scroll-up anchor stability, streaming follow, and long-jump fill — the third only shows up with heavy rows (markdown + highlighting), so lightweight demos miss it.4. Integration validation with astryx's own row components.
ChatMessage,ChatToolCalls,ChatSystemMessage, andMarkdownrun unchanged inside LegendList web in a production astryx-based desktop client — including prompt-pinning (reserving response space below the just-sent user message) viaanchoredEndSpace, and per-row-type size estimation viagetItemType. Whatever shape Option B takes, the row components already compose; the open design surface is confined to the list/scroll layer.Net effect: Option B now has three production references with converging vocabulary — identity anchoring, edge pinning with a threshold, committed programmatic scrolls, type-aware estimates — and a shipped a11y precedent to compare against rather than prior art alone. Happy to fold any of this into the RFC body if maintainers prefer it there.
yyq1025 commentedon Aug 25, 2026
Update on the Option B side: I've opened #5461 — a draft
ChatVirtualizerfor lab plus two storybook stories that run a virtualized and an unvirtualized arm over the same corpus. Live preview (no checkout needed): https://facebook.github.io/astryx/pr/5461/?path=/story/lab-chatvirtualization--thousands-of-messages — setmessageCountto 3000 and send a message, then do the same in the "Unvirtualized Baseline" story: streaming re-renders every mounted row, which measures ~8fps unvirtualized vs the machine's full frame rate with ~17 rows mounted (the status pill shows both live).fix(chat): anchor load-earlier on top-aligned lists
feat(lab): experimental ChatVirtualizer (#5461)
yyq1025 commentedon Nov 11, 2026
Closing this as resolved. Option B landed as the experimental
ChatVirtualizerin@astryxdesign/lab(#5461), andarchitecture:list-windowingnow names Chat as a consumer of the shared windowing engine in Core (#10810), so the remaining convergence work is tracked there.Not covered: Option A (a load-earlier affordance on
ChatMessageList) was not pursued. If someone needs it, a new RFC is the right place.One open design question from the virtualizer work, how new-message announcements relate to row mounting, is in #11141.