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

Function writeSharedHeight

src/hooks/useVirtualScroll.ts:95–107  ·  view source on GitHub ↗
(columns: number, key: string, height: number)

Source from the content-addressed store, hash-verified

93}
94
95function writeSharedHeight(columns: number, key: string, height: number): void {
96 const cacheKey = sharedHeightCacheKey(columns, key)
97 if (sharedHeightCache.get(cacheKey) === height) {
98 sharedHeightCache.delete(cacheKey)
99 sharedHeightCache.set(cacheKey, height)
100 return
101 }
102 if (sharedHeightCache.size >= SHARED_HEIGHT_CACHE_MAX) {
103 const oldest = sharedHeightCache.keys().next().value
104 if (oldest !== undefined) sharedHeightCache.delete(oldest)
105 }
106 sharedHeightCache.set(cacheKey, height)
107}
108
109export type VirtualScrollColdStartRangeInput = {
110 itemKeys: readonly string[]

Callers 1

useVirtualScrollFunction · 0.85

Calls 6

sharedHeightCacheKeyFunction · 0.85
deleteMethod · 0.80
setMethod · 0.80
keysMethod · 0.80
getMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected