Repository navigation
Conversation
….setOptions VirtualizerController captured options only in its constructor, so later changes such as count never reached the underlying Virtualizer. setOptions merges a partial update over the controller's stored options, keeps the host onChange wrapper, and refreshes the virtualizer. Co-authored-by: Rahul Kashyap <itisrmk@users.noreply.github.com>
🦋 Changeset detectedLatest commit: 366e5d6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Hi! Could a maintainer approve the CI workflows for this PR when you have a moment? Thanks. |
|
View your CI Pipeline Execution ↗ for commit 366e5d6
☁️ Nx Cloud last updated this comment at |
|
Thanks, this looks good. One thing: |
🎯 Changes
Fixes #1251.
VirtualizerControlleronly took options in its constructor, so options that come from reactive Lit properties (count,estimateSize,horizontal, and so on) never reached the virtualizer after the first render. CallinggetVirtualizer().setOptions(...)directly isn't a workaround, because it replaces the options wholesale and drops the controller'sonChangewrapper that re-renders the host.This adds
setOptionstoVirtualizerControllerandWindowVirtualizerController:undefinedvalues so a partial update can't wipe a stored option.onChangeso the host still re-renders, pushes the merged options to the virtualizer, and calls_willUpdate().willUpdateit doesn't schedule an extra host update, since that render pass hasn't happened yet. Called anywhere else it requests one.This picks up the feedback on #1253 (closed without merging): the test now checks the rendered total size (500 then 1000) instead of waiting for an item index the viewport can't show, the changeset is
minorbecause it's new public API, anddocs/framework/lit/lit-virtual.mdplus the package README now coversetOptionsand why to use it instead ofgetVirtualizer().setOptions(...).✅ Checklist
pnpm run test:pr.For
@tanstack/lit-virtualI ran vitest (13/13 passing), eslint,tsc, the production build, andpublint --strict. I didn't run the fulltest:prmatrix.🚀 Release Impact
Summary by CodeRabbit
New Features
setOptionssupport to Lit virtualizer controllers, enabling partial, reactive option updates.undefined.Documentation