Skip to content

feat: add chat virtualizer options#3168

Open
segunadebayo wants to merge 16 commits into
v2from
cursor/listvirtualizer-chat-options-2736
Open

feat: add chat virtualizer options#3168
segunadebayo wants to merge 16 commits into
v2from
cursor/listvirtualizer-chat-options-2736

Conversation

@segunadebayo

@segunadebayo segunadebayo commented Jun 5, 2026

Copy link
Copy Markdown
Member

Closes #

📝 Description

Adds chat-oriented virtualizer options and helpers for end-anchored list experiences.

⛳️ Current behavior (updates)

List virtualization preserves top/start anchors and supports manual prepend compensation, but it does not expose a first-class end anchor, conditional append following, or end-distance helpers for chat UIs.

🚀 New behavior

  • Adds anchorTo, followOnAppend, and scrollEndThreshold options.
  • Adds scrollToEnd(), getDistanceFromEnd(), and isAtEnd() helpers.
  • Keeps end-anchored viewports pinned when the latest row grows.
  • Uses the attached scroll element for end-distance and end-scroll calculations when available.
  • Hardens key restoration so keyToIndex -1 results are treated as missing keys.
  • Adds a full-width Next chat example with auto-load older history, manual load-older history, append/no-yank behavior, streamed replies, and a latest-message control.
  • Keeps the chat example pinned to latest when manual history loading is triggered from the latest position, while preserving viewport position for near-top auto history loading.
  • Adds unit coverage, virtualizer guide updates, and chat-focused E2E coverage.

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Verification:

  • pnpm exec vitest packages/utilities/virtualizer/tests/list-virtualizer.test.ts --run
  • pnpm --filter @zag-js/virtualizer typecheck
  • pnpm build
  • FRAMEWORK=react pnpm exec playwright test e2e/virtualizer.e2e.ts -g "(/virtualizer/chat|chat example)"
Open in Web Open in Cursor 

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zag-nextjs Ready Ready Preview Jun 5, 2026 11:10pm
zag-solid Ready Ready Preview Jun 5, 2026 11:10pm
zag-svelte Ready Ready Preview Jun 5, 2026 11:10pm
zag-vue Ready Ready Preview Jun 5, 2026 11:10pm
zag-website Ready Ready Preview Jun 5, 2026 11:10pm

Request Review

@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 66d7668

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 89 packages
Name Type
@zag-js/virtualizer Minor
@zag-js/anatomy-icons Minor
@zag-js/anatomy Minor
@zag-js/core Minor
@zag-js/docs Minor
@zag-js/preact Minor
@zag-js/react Minor
@zag-js/solid Minor
@zag-js/svelte Minor
@zag-js/vanilla Minor
@zag-js/vue Minor
@zag-js/accordion Minor
@zag-js/angle-slider Minor
@zag-js/async-list Minor
@zag-js/avatar Minor
@zag-js/carousel Minor
@zag-js/cascade-select Minor
@zag-js/checkbox Minor
@zag-js/clipboard Minor
@zag-js/collapsible Minor
@zag-js/color-picker Minor
@zag-js/combobox Minor
@zag-js/date-input Minor
@zag-js/date-picker Minor
@zag-js/dialog Minor
@zag-js/dnd Minor
@zag-js/drawer Minor
@zag-js/editable Minor
@zag-js/file-upload Minor
@zag-js/floating-panel Minor
@zag-js/gridlist Minor
@zag-js/hover-card Minor
@zag-js/image-cropper Minor
@zag-js/listbox Minor
@zag-js/marquee Minor
@zag-js/menu Minor
@zag-js/navigation-menu Minor
@zag-js/number-input Minor
@zag-js/pagination Minor
@zag-js/password-input Minor
@zag-js/pin-input Minor
@zag-js/popover Minor
@zag-js/presence Minor
@zag-js/progress Minor
@zag-js/qr-code Minor
@zag-js/radio-group Minor
@zag-js/rating-group Minor
@zag-js/scheduler Minor
@zag-js/scroll-area Minor
@zag-js/select Minor
@zag-js/signature-pad Minor
@zag-js/slider Minor
@zag-js/splitter Minor
@zag-js/steps Minor
@zag-js/switch Minor
@zag-js/tabs Minor
@zag-js/tags-input Minor
@zag-js/timer Minor
@zag-js/toast Minor
@zag-js/toc Minor
@zag-js/toggle-group Minor
@zag-js/toggle Minor
@zag-js/tooltip Minor
@zag-js/tour Minor
@zag-js/tree-view Minor
@zag-js/store Minor
@zag-js/types Minor
@zag-js/aria-hidden Minor
@zag-js/auto-resize Minor
@zag-js/collection Minor
@zag-js/color-utils Minor
@zag-js/utils Minor
@zag-js/date-utils Minor
@zag-js/dismissable Minor
@zag-js/dom-query Minor
@zag-js/file-utils Minor
@zag-js/focus-trap Minor
@zag-js/focus-visible Minor
@zag-js/highlight-word Minor
@zag-js/hotkeys Minor
@zag-js/i18n-utils Minor
@zag-js/interact-outside Minor
@zag-js/json-tree-utils Minor
@zag-js/live-region Minor
@zag-js/popper Minor
@zag-js/rect-utils Minor
@zag-js/remove-scroll Minor
@zag-js/scroll-snap Minor
@zag-js/stringify-state Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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