@tanstack/virtual-core 3.19.6 → 3.19.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -240,6 +240,7 @@ class Virtualizer {
240
240
  }
241
241
  this._flushHoldIfReady(true);
242
242
  this._writeAwaitingCommand();
243
+ this._retryClampedAdjustment();
243
244
  }
244
245
  });
245
246
  this._lastElementOffset = null;
@@ -618,7 +619,7 @@ class Virtualizer {
618
619
  });
619
620
  };
620
621
  this._retryClampedAdjustment = () => {
621
- if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled) {
622
+ if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled || !this._canWriteScroll()) {
622
623
  return;
623
624
  }
624
625
  const { target, maxAtWrite } = this._clampedAdjustment;
@@ -1184,7 +1185,7 @@ class Virtualizer {
1184
1185
  };
1185
1186
  this.getVirtualDistanceFromEnd = () => {
1186
1187
  return Math.max(
1187
- this._getLayoutTotalSize() - this.getSize() - this.getScrollOffset(),
1188
+ this._getLayoutTotalSize() + this.options.scrollMargin - this.getSize() - this.getScrollOffset(),
1188
1189
  0
1189
1190
  );
1190
1191
  };
@@ -1486,6 +1487,8 @@ class Virtualizer {
1486
1487
  // scroll as landed; an offset target never does, so its first scroll
1487
1488
  // event is read as the user's (see the scroll handler in `_willUpdate`).
1488
1489
  _startScroll(target, offset, behavior, kind) {
1490
+ this.pendingScrollAnchor = null;
1491
+ this._clampedAdjustment = null;
1489
1492
  const tail = this._iosGesture.tail();
1490
1493
  if (kind === "absolute" && tail !== null) {
1491
1494
  if (tail === "fling" && iosGesture.iosMomentumOverridesWrites()) {