Skip to content

Commit

Permalink
fix pushTransition for transition tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Apr 11, 2022
1 parent 0568c0f commit e38d08b
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 e38d08b

Please sign in to comment.