MCPcopy Create free account
hub / github.com/caseywebdev/react-list / useMemoCache

Function useMemoCache

docs/index.js:7357–7390  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

7355 throw Error(formatProdErrorMessage(438, String(usable)));
7356}
7357function useMemoCache(size) {
7358 var memoCache = null,
7359 updateQueue = currentlyRenderingFiber$1.updateQueue;
7360 null !== updateQueue && (memoCache = updateQueue.memoCache);
7361 if (null == memoCache) {
7362 var current = currentlyRenderingFiber$1.alternate;
7363 null !== current &&
7364 ((current = current.updateQueue),
7365 null !== current &&
7366 ((current = current.memoCache),
7367 null != current &&
7368 (memoCache = {
7369 data: current.data.map(function (array) {
7370 return array.slice();
7371 }),
7372 index: 0
7373 })));
7374 }
7375 null == memoCache && (memoCache = { data: [], index: 0 });
7376 null === updateQueue &&
7377 ((updateQueue = createFunctionComponentUpdateQueue()),
7378 (currentlyRenderingFiber$1.updateQueue = updateQueue));
7379 updateQueue.memoCache = memoCache;
7380 updateQueue = memoCache.data[memoCache.index];
7381 if (void 0 === updateQueue)
7382 for (
7383 updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0;
7384 current < size;
7385 current++
7386 )
7387 updateQueue[current] = REACT_MEMO_CACHE_SENTINEL;
7388 memoCache.index++;
7389 return updateQueue;
7390}
7391function basicStateReducer(state, action) {
7392 return "function" === typeof action ? action(state) : action;
7393}

Callers 1

index.jsFile · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…