Skip to content

Commit 4f5ccc1

Browse files
ci: apply automated fixes
1 parent d3509d9 commit 4f5ccc1

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

.changeset/fix-spanning-item-scroll-drift.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@tanstack/virtual-core': patch
33
---
44

5-
Stop the default scroll-adjustment heuristic from drifting the viewport when a viewport-spanning item grows. Previously any item whose top sat above the fold (`itemStart < scrollOffset`) had its size delta compensated on every re-measure — including a streaming chat message that spans the fold and grows at its bottom, dragging `scrollTop` downward token by token (#1218). Re-measurements now only compensate items that are *entirely* above the fold (`itemStart + itemSize <= scrollOffset`); growth below the anchor point leaves the scroll position untouched. First measurements (estimate→actual) still compensate any above-fold item, and a custom `shouldAdjustScrollPositionOnItemSizeChange` still overrides the default.
5+
Stop the default scroll-adjustment heuristic from drifting the viewport when a viewport-spanning item grows. Previously any item whose top sat above the fold (`itemStart < scrollOffset`) had its size delta compensated on every re-measure — including a streaming chat message that spans the fold and grows at its bottom, dragging `scrollTop` downward token by token (#1218). Re-measurements now only compensate items that are _entirely_ above the fold (`itemStart + itemSize <= scrollOffset`); growth below the anchor point leaves the scroll position untouched. First measurements (estimate→actual) still compensate any above-fold item, and a custom `shouldAdjustScrollPositionOnItemSizeChange` still overrides the default.

packages/virtual-core/tests/index.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,9 +3423,8 @@ test('anchorTo end: setOptions re-anchor clamps tracked scrollOffset at 0 (#1229
34233423
// ENTIRELY above the fold should shift scrollTop on re-measure.
34243424
function makeAdjustmentVirtualizer(scrollTop: number) {
34253425
const scrollToFn = vi.fn(elementScroll)
3426-
let scrollCallback:
3427-
| ((offset: number, isScrolling: boolean) => void)
3428-
| null = null
3426+
let scrollCallback: ((offset: number, isScrolling: boolean) => void) | null =
3427+
null
34293428
const el = {
34303429
scrollTop,
34313430
scrollLeft: 0,

0 commit comments

Comments
 (0)