virtualizer.getVirtualItems() return zero items for vanilla js project
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với CodePen được liên kết và điểm vào Virtualizer/getVirtualItems, tái hiện kết quả rỗng với [email protected] bằng vanilla JavaScript. Truy vết quá trình khởi tạo và các đầu vào viewport được hiển thị trong issue, sau đó xác minh rằng getVirtualItems() trả về phạm vi không rỗng như mong đợi cho danh sách 10.000 mục.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I need to implement virtual list in vanilla js.
I used this approach:
<script type="module" defer>
import { Virtualizer } from 'https://cdn.jsdelivr.net/npm/@tanstack/[email protected]/+esm';
// other code...
// Initialize the virtualizer
const virtualizer = new Virtualizer({
debug: true,
count: 10000, // The number of items in the list
getScrollElement: () => container,
estimateSize: () => 50, // The estimated size of each item
overscan: 5, // How many items to render outside of the viewport
});
// other code...
const items = virtualizer.getVirtualItems();
// items.length always === 0
</script>
No matter what I do, the array of items is always empty. But virtualizer.measurementsCache.length === 10000.
Your minimal, reproducible example
https://codepen.io/Dugnist/pen/LYveoXQ
Steps to reproduce
<script type="module" defer>
import { Virtualizer } from 'https://cdn.jsdelivr.net/npm/@tanstack/[email protected]/+esm';
</script>
const virtualizer = new Virtualizer({
debug: true,
count: 10000, // The number of items in the list
getScrollElement: () => container,
estimateSize: () => 50, // The estimated size of each item
overscan: 5, // How many items to render outside of the viewport
});
3
const items = virtualizer.getVirtualItems(); // -> []
Expected behavior
const items = virtualizer.getVirtualItems() should return array with more than zero items
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
codepen
tanstack-virtual version
TypeScript version
vanilla js
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.2k
- Fork
- 495
- Merge trung bình
- 15 giờ 11 phút
- Pull request đã merge (30 ngày)
- 17
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
-
Document the indexAttribute option and cover it with a testCó thể đã có người làm @officialasishkumar đã 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
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 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
-
With `useScrollendEvent`, scrollToIndex and scrollToEnd stop short when the target moves while they settleCó thể đã có người làm @Darkatse đã nhận 11 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
svelte-virtual renders no rows when the scroll element is bound after the store subscribesCó thể đã có người làm @clean99 đã nhận 15 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesCó thể đã có người làm @duongynhi000001-crypto đã nhận 15 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fb55/htmlparser2#2579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue needs-review
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add Module DB RulesĐang mởdocumentation public
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
midnightntwrk/umbradb#65 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area/channels kind/bug priority/medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nanocoai/nanoclaw#4501 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docker images: plain X.Y.Z tag (e.g. 7.2.3) is never updated after the initial release buildĐang mởneeds verification
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 13 ngày