GeezerVison is showing github.com — Release pooled cache reference in complete/unwind (#22464) · react/react@201af81
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-reconciler/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCacheComponent.new.js +6-4Lines changed: 6 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -99,14 +99,16 @@ export function popRootCachePool(root: FiberRoot, renderLanes: Lanes) { |
99 | 99 | return; |
100 | 100 | } |
101 | 101 | // The `pooledCache` variable points to the cache that was used for new |
102 | | - // cache boundaries during this render, if any. Stash it on the root so that |
103 | | - // parallel transitions may share the same cache. We will clear this field |
104 | | - // once all the transitions that depend on it (which we track with |
105 | | - // `pooledCacheLanes`) have committed. |
| 102 | + // cache boundaries during this render, if any. Move ownership of the |
| 103 | + // cache to the root so that parallel transitions may share the same |
| 104 | + // cache. We will clear this field once all the transitions that depend |
| 105 | + // on it (which we track with `pooledCacheLanes`) have committed. |
106 | 106 | root.pooledCache = pooledCache; |
107 | 107 | if (pooledCache !== null) { |
108 | 108 | root.pooledCacheLanes |= renderLanes; |
109 | 109 | } |
| 110 | + // set to null, conceptually we are moving ownership to the root |
| 111 | + pooledCache = null; |
110 | 112 | } |
111 | 113 |
|
112 | 114 | export function restoreSpawnedCachePool( |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberCacheComponent.old.js +6-4Lines changed: 6 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -99,14 +99,16 @@ export function popRootCachePool(root: FiberRoot, renderLanes: Lanes) { |
99 | 99 | return; |
100 | 100 | } |
101 | 101 | // The `pooledCache` variable points to the cache that was used for new |
102 | | - // cache boundaries during this render, if any. Stash it on the root so that |
103 | | - // parallel transitions may share the same cache. We will clear this field |
104 | | - // once all the transitions that depend on it (which we track with |
105 | | - // `pooledCacheLanes`) have committed. |
| 102 | + // cache boundaries during this render, if any. Move ownership of the |
| 103 | + // cache to the root so that parallel transitions may share the same |
| 104 | + // cache. We will clear this field once all the transitions that depend |
| 105 | + // on it (which we track with `pooledCacheLanes`) have committed. |
106 | 106 | root.pooledCache = pooledCache; |
107 | 107 | if (pooledCache !== null) { |
108 | 108 | root.pooledCacheLanes |= renderLanes; |
109 | 109 | } |
| 110 | + // set to null, conceptually we are moving ownership to the root |
| 111 | + pooledCache = null; |
110 | 112 | } |
111 | 113 |
|
112 | 114 | export function restoreSpawnedCachePool( |
|