Virtualized list wrapper keeps stale height after data changes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend, performance
Hướng nghiên cứu
Bắt đầu bằng cách tìm component List sử dụng useWindowVirtualizer và kiểm tra cách rows.length cùng getTotalSize() được đưa vào style của wrapper. So sánh hành vi với commit da4a20196356fd7d96e0fb9b69be9bd662294eeb và tái hiện một thay đổi về bộ lọc hoặc phân trang. Hoàn tất khi chiều cao của wrapper và thanh cuộn phản ánh số hàng đã cập nhật mà không có khoảng trống dư thừa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Summary
List uses useWindowVirtualizer for row virtualization, but the outer div’s inline
height is read directly from rowVirtualizer.getTotalSize() during render. Because the
virtualizer instance is stable and the getter mutates internal state without changing referential
identity, React never receives a new height value when the rows array is filtered or otherwise
resized. The wrapper therefore preserves an outdated, overly tall height, leaving a large blank
spacer below the visible rows and causing scroll position jumps.
Impact
Any operation that changes the number of rows (search, filters, pagination reset) leaves the
list container at its previous height. Users see excessive empty space and the scroll bar no
longer reflects the actual result size.
Root Cause
getTotalSize() is invoked inline inside JSX. The virtualizer recomputes its measurement cache,
but React doesn’t detect that the returned string (e.g., "32000px") should change because the
component never re-renders with a different computed value tied to the rows count.
Fix in my case
Memoize the total height using useMemo(() => rowVirtualizer.getTotalSize(), [rowVirtualizer, rows.length]) and pass that memoized number to the style prop. This forces a fresh height
string whenever the virtualizer’s count changes, keeping the spacer in sync. Implemented in commit
Your minimal, reproducible example
https://github.com/kosovatools/kosovatools.org/commit/da4a20196356fd7d96e0fb9b69be9bd662294eeb
Steps to reproduce
.
Expected behavior
Height react to count change
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Firefox
tanstack-virtual version
3.13.12
TypeScript version
5.7.3
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 7.1k
- Fork
- 472
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/virtual
-
measureElement caches 0 size for nodes that aren't attached yet (Vue: rows stack at start 0 and the list scrolls away on mount)Có thể đã có người làm @webn00b đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`scrollToIndex(last, { align: 'end' })` stays short of the end after a measured row grows (virtual-core ≥ 3.17.0)Có thể đã có người làm @minwookshin đã nhận 6 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
TanStack/virtual#1290 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
virtual-core: desktop Safari drops the prepend anchor write when history lands during the top rubber-band bounceCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
marko-virtual: scrollToEnd during an in-flight prepend strands the view one prepend above the bottom (chat-pretext e2e fails on CI)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/virtual
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AOSSIE-Org/DebateAI#611 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Upgrade node-libzim to 4.7.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
openzim/mwoffliner#2933 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use the README category name for website links and submissionsCó thể đã có người làm @dajiaohuang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
birobirobiro/awesome-shadcn-ui#647 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Twake Drive picker: closePicker() never destroys the intent (stop() is on the promise returned by start(), not by create())Có thể đã có người làm @chibenwa đã nhận hôm nay. Đang mởclaude
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
linagora/twake-calendar-frontend#1498 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Valea Prahovei TV RO SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày