Skip to content

Commit

Permalink
old
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Apr 11, 2022
1 parent 1e7dbc3 commit a9a7e6a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
import type {
OffscreenProps,
OffscreenState,
OffscreenQueue,
} from './ReactFiberOffscreenComponent';
import type {
Cache,
Expand Down Expand Up @@ -256,6 +257,7 @@ import {
getSuspendedCache,
pushTransition,
getOffscreenDeferredCache,
getSuspendedTransitions,
} from './ReactFiberTransition.old';

const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
Expand Down Expand Up @@ -2160,6 +2162,16 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
renderLanes,
);
workInProgress.memoizedState = SUSPENDED_MARKER;
if (enableTransitionTracing) {
const currentTransitions = getSuspendedTransitions();
if (currentTransitions !== null) {
const primaryChildUpdateQueue: OffscreenQueue = {
transitions: currentTransitions,
};
primaryChildFragment.updateQueue = primaryChildUpdateQueue;
}
}

return fallbackFragment;
} else if (
enableCPUSuspense &&
Expand Down Expand Up @@ -2280,6 +2292,15 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
prevOffscreenState === null
? mountSuspenseOffscreenState(renderLanes)
: updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
if (enableTransitionTracing) {
const currentTransitions = getSuspendedTransitions();
if (currentTransitions !== null) {
const primaryChildUpdateQueue: OffscreenQueue = {
transitions: currentTransitions,
};
primaryChildFragment.updateQueue = primaryChildUpdateQueue;
}
}
primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree(
current,
renderLanes,
Expand Down Expand Up @@ -2321,6 +2342,17 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
current,
renderLanes,
);

if (enableTransitionTracing) {
const currentTransitions = getSuspendedTransitions();
if (currentTransitions !== null) {
const primaryChildUpdateQueue: OffscreenQueue = {
transitions: currentTransitions,
};
primaryChildFragment.updateQueue = primaryChildUpdateQueue;
}
}

// Skip the primary children, and continue working on the
// fallback children.
workInProgress.memoizedState = SUSPENDED_MARKER;
Expand Down
5 changes: 5 additions & 0 deletions packages/react-reconciler/src/ReactFiberCommitWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,11 @@ function commitPassiveMountOnFiber(
}
}
}

if (enableTransitionTracing) {
// TODO: Add code to actually process the update queue
finishedWork.updateQueue = null;
}
break;
}
case CacheComponent: {
Expand Down

0 comments on commit a9a7e6a

Please sign in to comment.