@tanstack/virtual-core 3.0.1 → 3.0.3

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/src/index.ts CHANGED
@@ -503,7 +503,13 @@ export class Virtualizer<
503
503
 
504
504
  return furthestMeasurements.size === this.options.lanes
505
505
  ? Array.from(furthestMeasurements.values()).sort(
506
- (a, b) => a.end - b.end,
506
+ (a, b) => {
507
+ if (a.end === b.end) {
508
+ return a.index - b.index;
509
+ }
510
+
511
+ return a.end - b.end;
512
+ },
507
513
  )[0]
508
514
  : undefined
509
515
  }
@@ -653,7 +659,9 @@ export class Virtualizer<
653
659
  const delta = size - itemSize
654
660
 
655
661
  if (delta !== 0) {
656
- if (item.start < this.scrollOffset) {
662
+ if (
663
+ item.start < this.scrollOffset + this.scrollAdjustments
664
+ ) {
657
665
  if (process.env.NODE_ENV !== 'production' && this.options.debug) {
658
666
  console.info('correction', delta)
659
667
  }