Window & Dynamic Size List Virtualization Causes Mobile Safari IOS Scroll Momentum Interruption
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- react, typescript
- Área
- frontend, performance
Línea de trabajo
Comienza con la reproducción de CodeSandbox proporcionada y el ejemplo de useWindowVirtualizer, y pruébalo en Mobile iOS Safari con elementos de tamaño dinámico. Investiga la interacción entre los elementos medidos que se virtualizan y el desplazamiento con inercia de la ventana; se considera terminado cuando la reproducción mantiene un desplazamiento con inercia fluido mientras la virtualización sigue activa.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
By using the useWindowVirtualizer hook to apply virtualization for list items with different heights in relation to window scrolling, when you scroll, the virtualization behavior will occur.
Items that no longer need to be rendered will disappear from the DOM, and the list items corresponding to the visible indices will begin to appear in the DOM.
On Mobile iOS Safari, momentum scrolling triggered by user gestures works, but when combined with virtualization, the momentum effect fails to end smoothly and instead stutters or breaks abruptly. Is there a way to resolve this issue?
import "./styles.css";
import { useWindowVirtualizer } from "@tanstack/react-virtual";
const createRandomHeights = (
min: number,
max: number,
count: number = 1000
) => {
const heights = [];
for (let i = 0; i < count; i++) {
heights.push(Math.floor(Math.random() * (max - min + 1) + min));
}
return heights;
};
const randomHeights = createRandomHeights(100, 400);
const colors = ["red", "yellow", "blue"];
export default function App() {
const virtualizer = useWindowVirtualizer({
count: 1000,
estimateSize: () => 400,
overscan: 5,
scrollMargin: 0,
});
const virtualItems = virtualizer.getVirtualItems();
return (
<div>
<div
style={{
height: `${virtualizer.getTotalSize()}px`,
position: "relative",
width: "100%",
}}
>
<div
style={{
transform: `translateY(${
(virtualItems[0]?.start ?? 0) - virtualizer.options.scrollMargin
}px)`,
position: "absolute",
left: "0",
top: "0",
width: "100%",
}}
>
{virtualItems.map((virtualItem) => {
return (
<div
key={virtualItem.key}
data-index={virtualItem.index}
ref={virtualizer.measureElement}
style={{
paddingTop: "40px",
}}
>
<div
style={{
height: randomHeights[virtualItem.index],
backgroundColor: colors[virtualItem.index % 3],
}}
></div>
</div>
);
})}
</div>
</div>
</div>
);
}
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/qhkvyz
Steps to reproduce
- Go to CodeSandbox Link
- Scroll down Preview Page
- As you scroll, the momentum scroll stops occurring and the scrolling becomes increasingly choppy.
Expected behavior
I hope to maintain a seamless momentum scroll experience.
How often does this bug happen?
Every time
Screenshots or Videos
https://github.com/user-attachments/assets/2b27fcd6-e3de-449b-ac20-2633d76619d3
https://github.com/user-attachments/assets/166be2b0-cab1-495a-a9e1-9b770e31c1fc
Platform
- OS: IOS
- Browser: Safari
- Version: 18.1, 17.6.1
tanstack-virtual version
v3.10.6
TypeScript version
v5.4.5
Additional context
It seems that the CodeSandbox link is difficult to run on Mobile iOS Safari at the moment. However, you can reproduce the issue by running the attached source code.
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.1k
- Forks
- 468
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 12
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/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 68/100
microsoft/vscode-livepreview#876 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
JustJarethB/invoicer#54 ·
-
ICP 1.2.0 shows a scheduled task's interval in milliseconds under the label "Interval (In seconds)"AbiertoNeeds Triage Type/Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
wso2/product-integrator#2585 ·
Los mantenedores suelen responder en 1 día
-
Add: Telemundo West sdAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
design
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
MTES-MCT/monitor-field#119 ·
Los mantenedores suelen responder en 1 día