@tanstack/virtual-core 3.19.6 → 3.19.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/virtual-core",
3
- "version": "3.19.6",
3
+ "version": "3.19.7",
4
4
  "description": "Headless UI for virtualizing scrollable elements in TS/JS + Frameworks",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -583,6 +583,9 @@ export class Virtualizer<
583
583
  }
584
584
  this._flushHoldIfReady(true)
585
585
  this._writeAwaitingCommand()
586
+ // A clamped write the touch held back; a command written above has
587
+ // cleared it.
588
+ this._retryClampedAdjustment()
586
589
  },
587
590
  })
588
591
  // The last position the scroll handler was given, in the element's own
@@ -1290,11 +1293,14 @@ export class Virtualizer<
1290
1293
  // may follow at all), and from `_willUpdate` for consumers that size it
1291
1294
  // during an asynchronous render. Both the clamped read-back and the
1292
1295
  // absence of one leave `_clampedAdjustment` set, so timing does not matter.
1296
+ // While the element cannot take a write (`_canWriteScroll`) the record is
1297
+ // kept for the next opportunity, the latest being the tail closing.
1293
1298
  private _retryClampedAdjustment = () => {
1294
1299
  if (
1295
1300
  this._clampedAdjustment === null ||
1296
1301
  !this.scrollElement ||
1297
- !this.options.enabled
1302
+ !this.options.enabled ||
1303
+ !this._canWriteScroll()
1298
1304
  ) {
1299
1305
  return
1300
1306
  }
@@ -2429,6 +2435,12 @@ export class Virtualizer<
2429
2435
  behavior: ScrollBehavior,
2430
2436
  kind: 'absolute' | 'relative',
2431
2437
  ) {
2438
+ // A new explicit command supersedes layout-driven work queued before it.
2439
+ // Clear both before any iOS deferral so a later commit/retry cannot
2440
+ // overwrite the user's newer scroll intent.
2441
+ this.pendingScrollAnchor = null
2442
+ this._clampedAdjustment = null
2443
+
2432
2444
  const tail = this._iosGesture.tail()
2433
2445
  if (kind === 'absolute' && tail !== null) {
2434
2446
  if (tail === 'fling' && iosMomentumOverridesWrites()) {