Skip to content

Commit 9717dcb

Browse files
authored
Merge branch 'main' into docs/vue-dynamic-measure-timing
2 parents ac0f5f1 + c2f1c39 commit 9717dcb

69 files changed

Lines changed: 1359 additions & 246 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/virtualizer.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ A function that returns the scrollable element for the virtualizer. It may retur
3434
estimateSize: (index: number) => number
3535
```
3636

37-
> 🧠 If you are dynamically measuring your elements, it's recommended to estimate the largest possible size (width/height, within comfort) of your items. This will ensure features like smooth-scrolling will have a better chance at working correctly.
37+
> 🧠 If you are dynamically measuring your elements, it's recommended to estimate the largest possible size (width/height, within comfort) of your items. This will help the virtualizer calculate more accurate initial positions.
3838
3939
This function is passed the index of each item and should return the actual size (or estimated size if you will be dynamically measuring items with `virtualItem.measureElement`) for each item. This measurement should return either the width or height depending on the orientation of your virtualizer.
4040

@@ -166,8 +166,6 @@ An optional function that (if provided) should implement the scrolling behavior
166166

167167
Note that built-in scroll implementations are exported as `elementScroll` and `windowScroll`, which are automatically configured by the framework adapter functions like `useVirtualizer` or `useWindowVirtualizer`.
168168

169-
> ⚠️ Attempting to use smoothScroll with dynamically measured elements will not work.
170-
171169
### `observeElementRect`
172170

173171
```tsx
@@ -349,6 +347,23 @@ scrollToIndex: (
349347
350348
Scrolls the virtualizer to the items of the index provided. You can optionally pass an alignment mode to anchor the scroll to a specific part of the scrollElement.
351349
350+
> 🧠 During smooth scrolling, the virtualizer only measures items within a buffer range around the scroll target. Items far from the target are skipped to prevent their size changes from shifting the target position and breaking the smooth animation.
351+
>
352+
> Because of this, the preferred layout strategy for smooth scrolling is **block translation** — translate the entire rendered block using the first item's `start` offset, rather than positioning each item independently with absolute positioning. This ensures items stay correctly positioned relative to each other even when some measurements are skipped.
353+
354+
### `scrollBy`
355+
356+
```tsx
357+
scrollBy: (
358+
delta: number,
359+
options?: {
360+
behavior?: 'auto' | 'smooth'
361+
}
362+
) => void
363+
```
364+
365+
Scrolls the virtualizer by the specified number of pixels relative to the current scroll position.
366+
352367
### `getTotalSize`
353368
354369
```tsx

examples/angular/dynamic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
2020
"@faker-js/faker": "^8.4.1",
21-
"@tanstack/angular-virtual": "^4.0.6",
21+
"@tanstack/angular-virtual": "^4.0.10",
2222
"rxjs": "^7.8.2",
2323
"tslib": "^2.8.1",
2424
"zone.js": "0.15.1"

examples/angular/fixed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/platform-browser": "^18.1.0",
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
20-
"@tanstack/angular-virtual": "^4.0.6",
20+
"@tanstack/angular-virtual": "^4.0.10",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

examples/angular/infinite-scroll/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
2020
"@tanstack/angular-query-experimental": "5.80.7",
21-
"@tanstack/angular-virtual": "^4.0.6",
21+
"@tanstack/angular-virtual": "^4.0.10",
2222
"rxjs": "^7.8.2",
2323
"tslib": "^2.8.1",
2424
"zone.js": "0.15.1"

examples/angular/padding/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/platform-browser": "^18.1.0",
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
20-
"@tanstack/angular-virtual": "^4.0.6",
20+
"@tanstack/angular-virtual": "^4.0.10",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

examples/angular/smooth-scroll/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/platform-browser": "^18.1.0",
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
20-
"@tanstack/angular-virtual": "^4.0.6",
20+
"@tanstack/angular-virtual": "^4.0.10",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

examples/angular/sticky/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
2020
"@faker-js/faker": "^8.4.1",
21-
"@tanstack/angular-virtual": "^4.0.6",
21+
"@tanstack/angular-virtual": "^4.0.10",
2222
"rxjs": "^7.8.2",
2323
"tslib": "^2.8.1",
2424
"zone.js": "0.15.1"

examples/angular/table/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@angular/router": "^18.1.0",
2020
"@faker-js/faker": "^8.4.1",
2121
"@tanstack/angular-table": "8.21.3",
22-
"@tanstack/angular-virtual": "^4.0.6",
22+
"@tanstack/angular-virtual": "^4.0.10",
2323
"rxjs": "^7.8.2",
2424
"tslib": "^2.8.1",
2525
"zone.js": "0.15.1"

examples/angular/variable/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/platform-browser": "^18.1.0",
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
20-
"@tanstack/angular-virtual": "^4.0.6",
20+
"@tanstack/angular-virtual": "^4.0.10",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

examples/angular/window/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/platform-browser": "^18.1.0",
1818
"@angular/platform-browser-dynamic": "^18.1.0",
1919
"@angular/router": "^18.1.0",
20-
"@tanstack/angular-virtual": "^4.0.6",
20+
"@tanstack/angular-virtual": "^4.0.10",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

0 commit comments

Comments
 (0)