(cache: Cache)
| 101 | |
| 102 | // Cleanup a cache instance, potentially freeing it if there are no more references |
| 103 | export 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 | |
| 120 | export function pushCacheProvider(workInProgress: Fiber, cache: Cache) { |
| 121 | pushProvider(workInProgress, CacheContext, cache); |
no test coverage detected