()
| 317 | } |
| 318 | |
| 319 | export 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 | |
| 339 | export function getOffscreenDeferredCache(): SpawnedCachePool | null { |
| 340 | const cacheFromPool = peekCacheFromPool(); |
no test coverage detected