@tanstack/virtual-core 3.0.0-beta.57 → 3.0.0-beta.59
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/build/lib/index.d.ts +0 -1
- package/build/lib/index.esm.js +2 -4
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +2 -4
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +2 -4
- package/build/lib/index.mjs.map +1 -1
- package/build/umd/index.development.js +2 -4
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -9
package/src/index.ts
CHANGED
|
@@ -260,7 +260,6 @@ export interface VirtualizerOptions<
|
|
|
260
260
|
rangeExtractor?: (range: Range) => number[]
|
|
261
261
|
scrollMargin?: number
|
|
262
262
|
scrollingDelay?: number
|
|
263
|
-
elementKeyAttribute?: string
|
|
264
263
|
indexAttribute?: string
|
|
265
264
|
initialMeasurementsCache?: VirtualItem[]
|
|
266
265
|
lanes?: number
|
|
@@ -347,7 +346,6 @@ export class Virtualizer<
|
|
|
347
346
|
scrollMargin: 0,
|
|
348
347
|
scrollingDelay: 150,
|
|
349
348
|
indexAttribute: 'data-index',
|
|
350
|
-
elementKeyAttribute: 'data-element-key',
|
|
351
349
|
initialMeasurementsCache: [],
|
|
352
350
|
lanes: 1,
|
|
353
351
|
...opts,
|
|
@@ -623,10 +621,7 @@ export class Virtualizer<
|
|
|
623
621
|
) => {
|
|
624
622
|
const index = this.indexFromElement(node)
|
|
625
623
|
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
const elementKey =
|
|
629
|
-
node.getAttribute(this.options.elementKeyAttribute) ?? item.key
|
|
624
|
+
const elementKey = this.options.getItemKey(index)
|
|
630
625
|
|
|
631
626
|
const prevNode = this.measureElementCache.get(elementKey)
|
|
632
627
|
|
|
@@ -654,6 +649,7 @@ export class Virtualizer<
|
|
|
654
649
|
resizeItem = (index: number, size: number) => {
|
|
655
650
|
const item = this.measurementsCache[index]
|
|
656
651
|
if (!item) {
|
|
652
|
+
console.warn(`Missing virtual item for index = ${index}`)
|
|
657
653
|
return
|
|
658
654
|
}
|
|
659
655
|
|
|
@@ -675,9 +671,7 @@ export class Virtualizer<
|
|
|
675
671
|
|
|
676
672
|
this.pendingMeasuredCacheIndexes.push(index)
|
|
677
673
|
|
|
678
|
-
this.itemSizeCache = new Map(
|
|
679
|
-
this.itemSizeCache.set(item.key, size),
|
|
680
|
-
)
|
|
674
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size))
|
|
681
675
|
|
|
682
676
|
this.notify()
|
|
683
677
|
}
|