-
-
Notifications
You must be signed in to change notification settings - Fork 407
Open
Description
Describe the bug
As title. Only happens after going from v3.13.12 to v3.13.13.
Your minimal, reproducible example
See below.
Steps to reproduce
Run the following code, which is grabbed from the example with just an getItemKey() addition
import { useVirtualizer } from '@tanstack/react-virtual';
function App() {
// The scrollable element for your list
const parentRef = React.useRef(null)
// The virtualizer
const rowVirtualizer = useVirtualizer({
count: 10000,
getScrollElement: () => parentRef.current,
estimateSize: () => 35,
+ getItemKey: (index) => index,
})
return (
<>
{/* The scrollable element for your list */}
<div
ref={parentRef}
style={{
height: `400px`,
overflow: 'auto', // Make it scroll!
}}
>
{/* The large inner element to hold all of the items */}
<div
style={{
height: `${rowVirtualizer.getTotalSize()}px`,
width: '100%',
position: 'relative',
}}
>
{/* Only the visible items in the virtualizer, manually positioned to be in view */}
{rowVirtualizer.getVirtualItems().map((virtualItem) => (
<div
key={virtualItem.key}
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: `${virtualItem.size}px`,
transform: `translateY(${virtualItem.start}px)`,
}}
>
Row {virtualItem.index}
</div>
))}
</div>
</div>
</>
)
}Expected behavior
No error.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Windows 11 Edge (But I guess all browsers have this issue)
tanstack-virtual version
v3.13.13
TypeScript version
No response
Additional context
No response
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.
adubrouski, J4v4Scr1pt, j-marty, smn-cds, Glovvie and 3 more
Metadata
Metadata
Assignees
Labels
No labels