svelte-virtual renders no rows when the scroll element is bound after the store subscribes
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- frontend
Línea de trabajo
Start with the Svelte adapter’s createVirtualizer implementation and compare when it calls _willUpdate with the other adapters’ render or mount hooks. Reproduce the issue using the linked svelte-late-scroll-element example and inspect how a late bind:this assignment is handled. Done means all three lists render their seven visible rows; pull request #1368 is already open against this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
A Svelte virtualizer whose scroll element is assigned with bind:this renders no rows when the store is subscribed before the element is bound and nothing calls setOptions afterwards. The store's start callback reads getScrollElement() once, gets null, and attaches no observers.
This hits createVirtualizer inside $derived on Svelte 5 (the empty table in #866, worked around there by calling $virtualizer._willUpdate() after mount) and a virtualizer created once, as suggested in #656, when the count does not change after mount. The Svelte examples render because $: virtualizer = createVirtualizer(...) re-creates the virtualizer after the element is bound.
Your minimal, reproducible example
https://github.com/clean99/oss-pr-media/tree/main/tanstack-virtual/svelte-late-scroll-element
Steps to reproduce
- In the reproduction directory, run
npm ciandnpm run dev, then open the printed URL. - The page shows three lists of 1000 rows. Each has a 200px scroll container assigned with
bind:this. - "$derived" and "created once" show 0 rows and an empty container. "control" shows 7 rows: its
getScrollElementreads the element inside$derived, so it is re-created after binding.
Expected behavior
All three lists render their visible rows (7 for a 200px container with 35px rows).
How often does this bug happen?
Every time.
Screenshots or Videos
The heading above each list prints its row count.
Platform
macOS, Chromium (Playwright headless shell), Node.js 24.8.0, Svelte 5.57.3. The created-once component also renders 0 rows on Svelte 4.2.20.
tanstack-virtual version
@tanstack/svelte-virtual 3.13.52
TypeScript version
The reproduction uses JavaScript.
Additional context
The other adapters call _willUpdate after render or mount (React's layout effect, the Vue watcher on getScrollElement, Solid's onMount, Angular's afterRenderEffect, Lit's hostUpdated), so they pick up a ref assigned during render. In the Svelte adapter it only runs inside setOptions.
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
- 490
- Merge medio
- 15 h 28 min
- PR fusionados (30 d)
- 48
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
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesPosiblemente ocupada @duongynhi000001-crypto la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
-
anchorTo: 'end' loses the end when the scroll element shrinksPosiblemente ocupada @langleyd la tomó hace 32 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
marko-virtual: scrollToEnd during an in-flight prepend strands the view one prepend above the bottom (chat-pretext e2e fails on CI)Posiblemente ocupada @officialasishkumar la tomó hace 6 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
Scroll correction sometimes gets stuck on estimating row sizesPosiblemente ocupada @itisrmk la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
TanStack/virtual#1252 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
eslint-plugin-react-hooks v7 warning for useVirtualizer: Compilation Skipped: Use of incompatible libraryPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
TanStack/virtual#1119 · 11 comentarios · 32 reacciones ·
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 70/100
backnotprop/plannotator#2914 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/vscode-containers#655 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dsh-tauri-desk/deepseek-harness-desktop#1477 · 1 comentario ·