Skip to content

Commit

Permalink
fix pushTransition for transition tracing (#24338)
Browse files Browse the repository at this point in the history
We forgot to move pushTransition out from the enableCache flag in #24321 in a place that both transition tracing and cache need to push transitions. Move it out from behind the enableCache to prepare for the next PRs.
  • Loading branch information
lunaruan committed Apr 11, 2022
1 parent 069d23b commit 55a21ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Expand Up @@ -748,14 +748,16 @@ function updateOffscreenComponent(

subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);

let prevCachePool = null;
if (enableCache) {
// If the render that spawned this one accessed the cache pool, resume
// using the same cache. Unless the parent changed, since that means
// there was a refresh.
const prevCachePool = prevState.cachePool;
pushTransition(workInProgress, prevCachePool, null);
prevCachePool = prevState.cachePool;
}

pushTransition(workInProgress, prevCachePool, null);

// Since we're not hidden anymore, reset the state
workInProgress.memoizedState = null;
} else {
Expand Down
6 changes: 4 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Expand Up @@ -748,14 +748,16 @@ function updateOffscreenComponent(

subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);

let prevCachePool = null;
if (enableCache) {
// If the render that spawned this one accessed the cache pool, resume
// using the same cache. Unless the parent changed, since that means
// there was a refresh.
const prevCachePool = prevState.cachePool;
pushTransition(workInProgress, prevCachePool, null);
prevCachePool = prevState.cachePool;
}

pushTransition(workInProgress, prevCachePool, null);

// Since we're not hidden anymore, reset the state
workInProgress.memoizedState = null;
} else {
Expand Down

0 comments on commit 55a21ef

Please sign in to comment.