Skip to content

Commit

Permalink
fix: unexpected undefined error in Virtualizer._measureElement (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
piecyk committed Sep 4, 2023
1 parent 18f4018 commit 285449a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/virtual-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,9 @@ export class Virtualizer<
) => {
const index = this.indexFromElement(node)

const item = notUndefined(this.measurementsCache[index])

const elementKey =
node.getAttribute(this.options.elementKeyAttribute) ?? item.key
node.getAttribute(this.options.elementKeyAttribute) ??
this.options.getItemKey(index)

const prevNode = this.measureElementCache.get(elementKey)

Expand Down Expand Up @@ -675,9 +674,7 @@ export class Virtualizer<

this.pendingMeasuredCacheIndexes.push(index)

this.itemSizeCache = new Map(
this.itemSizeCache.set(item.key, size),
)
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size))

this.notify()
}
Expand Down

0 comments on commit 285449a

Please sign in to comment.