Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Nov 26, 2024
1 parent ff8e52b commit c7c6461
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,16 @@ export const estimateDefaultItemSize = (
): number => {
let measuredCountBeforeStart = 0;
// This function will be called after measurement so measured size array must be longer than 0
const measuredSizes = cache._sizes.filter((s, i) => {
const isMeasured = s !== UNCACHED;
if (isMeasured && i < startIndex) {
measuredCountBeforeStart++;
const prevDefaultItemSize = cache._defaultItemSize;
const measuredSizes: number[] = [];
cache._sizes.forEach((s, i) => {
if (s !== UNCACHED) {
measuredSizes.push(s);
if (i < startIndex) {
measuredCountBeforeStart++;
}
}
return isMeasured;
});
const prevDefaultItemSize = cache._defaultItemSize;

// Discard cache for now
cache._computedOffsetIndex = -1;
Expand Down

0 comments on commit c7c6461

Please sign in to comment.