TanStack / virtual

🤖 Headless UI for Virtualizing Large Element Lists in JS/TS, React, Solid, Vue and Svelte
https://tanstack.com/virtual
MIT License
5.5k stars 301 forks source link

solid-virtual: UI not updating when ```count``` changes in ```createVirtualizer``` parameters #661

Open rrajaste opened 9 months ago

rrajaste commented 9 months ago

Describe the bug

UI doesn't update when changing the count signal passed as a parameter to virtualizer

Your minimal, reproducible example

https://codesandbox.io/p/devbox/solidjs-tanstack-virtual-forked-67sdkh?file=%2Fsrc%2FApp.tsx%3A14%2C6&workspaceId=2c68d57c-2197-4b47-923d-3e4f5f971951

Steps to reproduce

Change the value inside "Row count" input on top of the list to update the count signal

Expected behavior

Virtualizer should update UI to render the correct count for rows.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Code sandbox

tanstack-virtual version

v3.0.4

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

barsikus007 commented 8 months ago

same here https://github.com/barsikus007/deb-ounce/tree/blazing-slow

barsikus007 commented 8 months ago

@rrajaste, I found solution: use get count() {return signal()} instead of count: signal()

btw this at least should be mentioned in docs

rrajaste commented 8 months ago

Thanks for the workaround, it seems to fix the issue. Although I think something like this should be hidden under the interface of createVirtualizer. Perhaps count should be a function in the createVirtualizer interface?

wilgaboury commented 4 months ago

Just wanted to note for others that in version 3.5.1, a reactive count using the get syntax still did not work. Once I upgraded to 3.7.0 it did.