({
cachedHeight,
estimatedHeight,
pessimisticHeight = PESSIMISTIC_HEIGHT,
}: {
cachedHeight: number | undefined
estimatedHeight: number | undefined
pessimisticHeight?: number
})
| 64 | const sharedHeightCache = new Map<string, number>() |
| 65 | |
| 66 | export function resolveVirtualScrollCoverageHeight({ |
| 67 | cachedHeight, |
| 68 | estimatedHeight, |
| 69 | pessimisticHeight = PESSIMISTIC_HEIGHT, |
| 70 | }: { |
| 71 | cachedHeight: number | undefined |
| 72 | estimatedHeight: number | undefined |
| 73 | pessimisticHeight?: number |
| 74 | }): number { |
| 75 | const height = cachedHeight ?? estimatedHeight ?? pessimisticHeight |
| 76 | return Number.isFinite(height) && height > 0 |
| 77 | ? Math.max(1, Math.ceil(height)) |
| 78 | : pessimisticHeight |
| 79 | } |
| 80 | |
| 81 | function sharedHeightCacheKey(columns: number, key: string): string { |
| 82 | return `${columns}:${key}` |
no test coverage detected