@samitouri / QOS-React / commits / 55a21ef7e7

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.

Luna Ruan committed Apr 11, 2022 at 16:54 UTC 55a21ef7e78a4e35302cbc7ffb19934a23cc6957
2 files changed +8 -4
packages/react-reconciler/src/ReactFiberBeginWork.new.js
+4 -2
@@ -748,14 +748,16 @@ function updateOffscreenComponent(
748
749 subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);
750
751 + let prevCachePool = null;
752 if (enableCache) {
753 // If the render that spawned this one accessed the cache pool, resume
754 // using the same cache. Unless the parent changed, since that means
755 // there was a refresh.
755 - const prevCachePool = prevState.cachePool;
756 - pushTransition(workInProgress, prevCachePool, null);
756 + prevCachePool = prevState.cachePool;
757 }
758
759 + pushTransition(workInProgress, prevCachePool, null);
760 +
761 // Since we're not hidden anymore, reset the state
762 workInProgress.memoizedState = null;
763 } else {
packages/react-reconciler/src/ReactFiberBeginWork.old.js
+4 -2
@@ -748,14 +748,16 @@ function updateOffscreenComponent(
748
749 subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes);
750
751 + let prevCachePool = null;
752 if (enableCache) {
753 // If the render that spawned this one accessed the cache pool, resume
754 // using the same cache. Unless the parent changed, since that means
755 // there was a refresh.
755 - const prevCachePool = prevState.cachePool;
756 - pushTransition(workInProgress, prevCachePool, null);
756 + prevCachePool = prevState.cachePool;
757 }
758
759 + pushTransition(workInProgress, prevCachePool, null);
760 +
761 // Since we're not hidden anymore, reset the state
762 workInProgress.memoizedState = null;
763 } else {