Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-ads-lose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/virtual-core': patch
---

Fixed observeElementOffset to prevent continuous rerenders during or after scrolling
8 changes: 7 additions & 1 deletion packages/virtual-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,13 @@ export class Virtualizer<
// self-write β€” by the time the user has moved 1.5 px, the
// intended value will already have been consumed by a prior
// scroll event and cleared.
if (offset === this.scrollOffset && isScrolling === true) {
// this prevents continous rerenders
isScrolling = false;
this.isScrolling = false;
this.scrollOffset = offset
this.maybeNotify();
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if (
this._intendedScrollOffset !== null &&
Math.abs(offset - this._intendedScrollOffset) < 1.5
Expand All @@ -804,7 +811,6 @@ export class Virtualizer<
if (this.scrollState) {
this.scheduleScrollReconcile()
}
this.maybeNotify()
}),
)

Expand Down