MCPcopy
hub / github.com/facebook/react / getSuspendedCache

Function getSuspendedCache

packages/react-reconciler/src/ReactFiberTransition.js:319–337  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

317}
318
319export function getSuspendedCache(): SpawnedCachePool | null {
320 // This function is called when a Suspense boundary suspends. It returns the
321 // cache that would have been used to render fresh data during this render,
322 // if there was any, so that we can resume rendering with the same cache when
323 // we receive more data.
324 const cacheFromPool = peekCacheFromPool();
325 if (cacheFromPool === null) {
326 return null;
327 }
328
329 return {
330 // We must also save the parent, so that when we resume we can detect
331 // a refresh.
332 parent: isPrimaryRenderer
333 ? CacheContext._currentValue
334 : CacheContext._currentValue2,
335 pool: cacheFromPool,
336 };
337}
338
339export function getOffscreenDeferredCache(): SpawnedCachePool | null {
340 const cacheFromPool = peekCacheFromPool();

Callers 2

Calls 1

peekCacheFromPoolFunction · 0.85

Tested by

no test coverage detected