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
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.
The text was updated successfully, but these errors were encountered:
dartess
changed the title
HMR (live reload, fast refresh) broke render
HMR (live reload, fast refresh) broke render in React
Jul 5, 2024
TLDR: scrollElement gets cleared in _didMount and that is why virtualizer stops working.
The only methods that can change scrollElement are: _willUpdate and _didMount.
On the initial run _willUpdate and _didMount are called in this order:
After triggering HMR _willUpdate and _didMount will be called in this order:
[2] - This means scrollElement gets cleared and set to null which "breaks" the virtualizer.
You can debug this in this CodeSandbox: https://codesandbox.io/p/devbox/4wnzrm
There you can find fixed useVirtualizerBase in src/hooks/useVirtualizerFixed.tsx.
Describe the bug
After the hot reload, new list items are not rendered
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-virtual-dc5j1h?file=src%2Fmain.tsx,src%2FRowVirtualizerFixed.tsx&preset=node
Steps to reproduce
console.log('foo');
with some different textExpected behavior
it should just work
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
any platform , any bundler — vite, wepack, rspack
tanstack-virtual version
3.8.1
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: