MCPcopy Create free account
hub / github.com/Noumena-Network/code / resolveVirtualScrollCoverageHeight

Function resolveVirtualScrollCoverageHeight

src/hooks/useVirtualScroll.ts:66–79  ·  view source on GitHub ↗
({
  cachedHeight,
  estimatedHeight,
  pessimisticHeight = PESSIMISTIC_HEIGHT,
}: {
  cachedHeight: number | undefined
  estimatedHeight: number | undefined
  pessimisticHeight?: number
})

Source from the content-addressed store, hash-verified

64const sharedHeightCache = new Map<string, number>()
65
66export 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
81function sharedHeightCacheKey(columns: number, key: string): string {
82 return `${columns}:${key}`

Callers 2

useVirtualScrollFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected