Skip to content

Commit 55a21ef

Browse files
authored
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.
1 parent 069d23b commit 55a21ef

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.new.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -748,14 +748,16 @@ function updateOffscreenComponent(
748748

749749
subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);
750750

751+
let prevCachePool = null;
751752
if (enableCache) {
752753
// If the render that spawned this one accessed the cache pool, resume
753754
// using the same cache. Unless the parent changed, since that means
754755
// there was a refresh.
755-
const prevCachePool = prevState.cachePool;
756-
pushTransition(workInProgress, prevCachePool, null);
756+
prevCachePool = prevState.cachePool;
757757
}
758758

759+
pushTransition(workInProgress, prevCachePool, null);
760+
759761
// Since we're not hidden anymore, reset the state
760762
workInProgress.memoizedState = null;
761763
} else {

packages/react-reconciler/src/ReactFiberBeginWork.old.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -748,14 +748,16 @@ function updateOffscreenComponent(
748748

749749
subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);
750750

751+
let prevCachePool = null;
751752
if (enableCache) {
752753
// If the render that spawned this one accessed the cache pool, resume
753754
// using the same cache. Unless the parent changed, since that means
754755
// there was a refresh.
755-
const prevCachePool = prevState.cachePool;
756-
pushTransition(workInProgress, prevCachePool, null);
756+
prevCachePool = prevState.cachePool;
757757
}
758758

759+
pushTransition(workInProgress, prevCachePool, null);
760+
759761
// Since we're not hidden anymore, reset the state
760762
workInProgress.memoizedState = null;
761763
} else {

0 commit comments

Comments
 (0)