You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Svelte onChange stops firing after a partial setOptions update #1343
After calling setOptions({ count: 110 }), an existing onChange callback stops firing. The store still updates. This affects both createVirtualizer and createWindowVirtualizer.
Its reproduce.mjs needs only @tanstack/svelte-virtual@3.13.49 and svelte@4.2.20. Run npm install and npm start. It uses the public measure() method to trigger a state-change notification, without rendering a component or relying on browser timing.
Steps to reproduce
Create a Svelte virtualizer with count: 100, estimateSize: () => 40, getScrollElement: () => null, and an onChange counter. Subscribe to its store.
Call measure(): the counter becomes 1.
Call setOptions({ count: 110 }), then measure() again.
The counter stays at 1 instead of becoming 2. The reproduction asserts this for both exported constructors.
Expected behavior
An omitted option should remain unchanged in a partial update. The existing onChange callback should still fire when virtualizer state changes, as described in the API reference.
How often does this bug happen?
Every time.
Screenshots or Videos
Not applicable; the reproduction checks callback invocations directly.
Platform
macOS 26.5.2, Node.js 24.16.0. No browser is needed for this reproduction.
tanstack-virtual version
@tanstack/svelte-virtual 3.13.49, Svelte 4.2.20.
TypeScript version
The reproduction is JavaScript. The regression tests use TypeScript 5.9.3.
Additional context
The Svelte infinite-scroll example uses a count-only update after fetching another page. Adding an onChange callback to that pattern loses the callback after the update.
Terms & Code of Conduct
I agree to follow this project's Code of Conduct.
I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Activity