Skip to content

Commit 21d9a46

Browse files
authored
fix(virtual-core): preserve auto alignment for visible items when scrolling (#1110)
1 parent 7fd2654 commit 21d9a46

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.changeset/two-swans-heal.md

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+
fix(virtual-core): preserve auto alignment for visible items when scrolling

packages/virtual-core/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,9 +1032,7 @@ export class Virtualizer<
10321032
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
10331033
align = 'start'
10341034
} else {
1035-
// Item is already visible, return current position with concrete alignment
1036-
// to avoid infinite retry loop if measurements change
1037-
return [scrollOffset, 'start'] as const
1035+
return [scrollOffset, align] as const
10381036
}
10391037
}
10401038

0 commit comments

Comments
 (0)