Skip to content

Commit 2900864

Browse files
committed
Merge branch 'main' into feat/defer-lane-assign
2 parents 8b1f8bd + 54d771a commit 2900864

67 files changed

Lines changed: 1085 additions & 196 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.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/virtual-core': patch
3+
---
4+
5+
Add 'instant' to ScrollBehavior type to match the W3C spec

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
@@ -360,6 +358,23 @@ scrollToIndex: (
360358
361359
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.
362360
361+
> 🧠 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.
362+
>
363+
> 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.
364+
365+
### `scrollBy`
366+
367+
```tsx
368+
scrollBy: (
369+
delta: number,
370+
options?: {
371+
behavior?: 'auto' | 'smooth'
372+
}
373+
) => void
374+
```
375+
376+
Scrolls the virtualizer by the specified number of pixels relative to the current scroll position.
377+
363378
### `getTotalSize`
364379
365380
```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.7",
21+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
20+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
21+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
20+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
20+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
21+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
22+
"@tanstack/angular-virtual": "^4.0.9",
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.7",
20+
"@tanstack/angular-virtual": "^4.0.9",
2121
"rxjs": "^7.8.2",
2222
"tslib": "^2.8.1",
2323
"zone.js": "0.15.1"

0 commit comments

Comments
 (0)