fix pushTransition for transition tracing (#24338)

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.
This commit is contained in:
Luna Ruan
2022-04-11 14:54:25 -07:00
committed by GitHub
parent 069d23bb74
commit 55a21ef7e7
2 changed files with 8 additions and 4 deletions
@@ -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 {
@@ -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 {