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 authored and rickhanlonii committed Apr 19, 2022
1 parent cfef6a0 commit 4c7553c
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 4c7553c

Please sign in to comment.