@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.
- package/dist/cjs/index.cjs +5 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +22 -2
package/package.json
CHANGED
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
|
}
|
|
@@ -2263,8 +2269,16 @@ export class Virtualizer<
|
|
|
2263
2269
|
}
|
|
2264
2270
|
|
|
2265
2271
|
private getVirtualDistanceFromEnd = () => {
|
|
2272
|
+
// `_getLayoutTotalSize()` measures the sizer, which starts `scrollMargin`
|
|
2273
|
+
// into the scroll content, while `getScrollOffset()` is measured from the
|
|
2274
|
+
// top of that content. Lift the total into the element's space before
|
|
2275
|
+
// subtracting, or the viewport reads `scrollMargin` px closer to the end
|
|
2276
|
+
// than it is and `getDistanceFromEnd()` disagrees by that much.
|
|
2266
2277
|
return Math.max(
|
|
2267
|
-
this._getLayoutTotalSize()
|
|
2278
|
+
this._getLayoutTotalSize() +
|
|
2279
|
+
this.options.scrollMargin -
|
|
2280
|
+
this.getSize() -
|
|
2281
|
+
this.getScrollOffset(),
|
|
2268
2282
|
0,
|
|
2269
2283
|
)
|
|
2270
2284
|
}
|
|
@@ -2429,6 +2443,12 @@ export class Virtualizer<
|
|
|
2429
2443
|
behavior: ScrollBehavior,
|
|
2430
2444
|
kind: 'absolute' | 'relative',
|
|
2431
2445
|
) {
|
|
2446
|
+
// A new explicit command supersedes layout-driven work queued before it.
|
|
2447
|
+
// Clear both before any iOS deferral so a later commit/retry cannot
|
|
2448
|
+
// overwrite the user's newer scroll intent.
|
|
2449
|
+
this.pendingScrollAnchor = null
|
|
2450
|
+
this._clampedAdjustment = null
|
|
2451
|
+
|
|
2432
2452
|
const tail = this._iosGesture.tail()
|
|
2433
2453
|
if (kind === 'absolute' && tail !== null) {
|
|
2434
2454
|
if (tail === 'fling' && iosMomentumOverridesWrites()) {
|