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

Function releaseCache

packages/react-reconciler/src/ReactFiberCacheComponent.js:103–118  ·  view source on GitHub ↗
(cache: Cache)

Source from the content-addressed store, hash-verified

101
102// Cleanup a cache instance, potentially freeing it if there are no more references
103export function releaseCache(cache: Cache) {
104 cache.refCount--;
105 if (__DEV__) {
106 if (cache.refCount < 0) {
107 console.warn(
108 'A cache instance was released after it was already freed. ' +
109 'This likely indicates a bug in React.',
110 );
111 }
112 }
113 if (cache.refCount === 0) {
114 scheduleCallback(NormalPriority, () => {
115 cache.controller.abort();
116 });
117 }
118}
119
120export function pushCacheProvider(workInProgress: Fiber, cache: Cache) {
121 pushProvider(workInProgress, CacheContext, cache);

Calls 2

scheduleCallbackFunction · 0.70
abortMethod · 0.65

Tested by

no test coverage detected