virtualizer.getVirtualItems() return zero items for vanilla js project
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, typescript
- Área
- frontend
Línea de trabajo
Comienza con el CodePen enlazado y el punto de entrada Virtualizer/getVirtualItems, reproduciendo el resultado vacío con [email protected] en vanilla JavaScript. Sigue la inicialización y las entradas del viewport que se muestran en el issue, y luego verifica que getVirtualItems() devuelva el rango no vacío esperado para la lista de 10.000 elementos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 7.2k
- Forks
- 495
- Merge medio
- 15 h 11 min
- PR fusionados (30 d)
- 17
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/virtual
-
Document the indexAttribute option and cover it with a testPosiblemente ocupada @officialasishkumar la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
With `useScrollendEvent`, scrollToIndex and scrollToEnd stop short when the target moves while they settlePosiblemente ocupada @Darkatse la tomó hace 11 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
svelte-virtual renders no rows when the scroll element is bound after the store subscribesPosiblemente ocupada @clean99 la tomó hace 15 días. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesPosiblemente ocupada @duongynhi000001-crypto la tomó hace 15 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/virtual
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fb55/htmlparser2#2579 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue needs-review
Dificultad 1/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Add Module DB RulesAbiertodocumentation public
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
midnightntwrk/umbradb#65 ·
Los mantenedores suelen responder en 2 días
-
area/channels kind/bug priority/medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nanocoai/nanoclaw#4501 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Docker images: plain X.Y.Z tag (e.g. 7.2.3) is never updated after the initial release buildAbiertoneeds verification
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 13 días