TanStack / TanStack/virtual

Angular virtual dynamic measuring not working properly

Open
#843 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
466
Avg merge
2d 31m
Merged PRs (30d)
13

Description

Describe the bug

I am having trouble getting a virtual scroll running properly. I have data that is very much dynamic within its size. There can be 1 or around 600000 entries that I want to display. Sadly I am having trouble getting something running properly. I forked the dynamic example from the docs.
When setting the entries to around 1000 the scroll works, but when increasing the amount of entries to 1000000 I can't scroll to the bottom and only see around 400000 entries. Playing around with the estimateSize property fixes the issue, but when scrolling the scroll behaviour is weird and jumps in big chunks.

Here is an example to show what I mean: https://stackblitz.com/edit/tanstack-virtual-pitwef?file=src%2Fapp%2Frow-virtualizer-dynamic.component.ts,src%2Fapp%2Fapp.routes.ts,src%2Fapp%2Fapp.component.ts,src%2Fapp%2Frow-virtualizer-dymaic-test.component.ts

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-virtual-pitwef?file=src%2Fapp%2Frow-virtualizer-dynamic.component.ts,src%2Fapp%2Fapp.routes.ts,src%2Fapp%2Fapp.component.ts,src%2Fapp%2Frow-virtualizer-dymaic-test.component.ts

Steps to reproduce
  1. Add a virtual-scroll container
  2. Set count to 9999 and estimateSize
  3. Change count to 999999 or more
Expected behavior

When the count of rows changes drastically, the virtual-scroll should be able to handle both cases without having to change the config programmatically.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS- with Safari Browser and Chromium Browsers

tanstack-virtual version

v3.10.8

TypeScript version

Tested locally with 5.5.4 in stackblitz 5.2.2

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked StackBlitz reproduction, especially src/app/row-virtualizer-dynamic.component.ts and the related app route and test component, then compare it with the Angular dynamic example in the documentation. Reproduce the failure when the row count grows from 9999 to 999999 or more, and verify that scrolling reaches the end without requiring a programmatic estimateSize change or producing large jumps.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.