Skip to content

Commit d0cdc9e

Browse files
committed
old
1 parent 530c759 commit d0cdc9e

5 files changed

+22
-22
lines changed

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

+7-11
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ import {
236236
markSkippedUpdateLanes,
237237
getWorkInProgressRoot,
238238
pushRenderLanes,
239-
getWorkInProgressTransitions,
240239
} from './ReactFiberWorkLoop.old';
241240
import {setWorkInProgressVersion} from './ReactMutableSource.old';
242241
import {pushCacheProvider, CacheContext} from './ReactFiberCacheComponent.old';
@@ -652,9 +651,11 @@ function updateOffscreenComponent(
652651
// Rendering a hidden tree.
653652
if ((workInProgress.mode & ConcurrentMode) === NoMode) {
654653
// In legacy sync mode, don't defer the subtree. Render it now.
654+
// TODO: Consider how Offscreen should work with transitions in the future
655655
const nextState: OffscreenState = {
656656
baseLanes: NoLanes,
657657
cachePool: null,
658+
transitions: null,
658659
};
659660
workInProgress.memoizedState = nextState;
660661
if (enableCache) {
@@ -688,6 +689,7 @@ function updateOffscreenComponent(
688689
const nextState: OffscreenState = {
689690
baseLanes: nextBaseLanes,
690691
cachePool: spawnedCachePool,
692+
transitions: null,
691693
};
692694
workInProgress.memoizedState = nextState;
693695
workInProgress.updateQueue = null;
@@ -723,6 +725,7 @@ function updateOffscreenComponent(
723725
const nextState: OffscreenState = {
724726
baseLanes: NoLanes,
725727
cachePool: null,
728+
transitions: null,
726729
};
727730
workInProgress.memoizedState = nextState;
728731
// Push the lanes that were skipped when we bailed out.
@@ -1343,13 +1346,6 @@ function updateHostRoot(current, workInProgress, renderLanes) {
13431346
}
13441347
}
13451348

1346-
if (enableTransitionTracing) {
1347-
// FIXME: Slipped past code review. This is not a safe mutation:
1348-
// workInProgress.memoizedState is a shared object. Need to fix before
1349-
// rolling out the Transition Tracing experiment.
1350-
workInProgress.memoizedState.transitions = getWorkInProgressTransitions();
1351-
}
1352-
13531349
// Caution: React DevTools currently depends on this property
13541350
// being called "element".
13551351
const nextChildren = nextState.element;
@@ -1363,6 +1359,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
13631359
element: nextChildren,
13641360
isDehydrated: false,
13651361
cache: nextState.cache,
1362+
pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries,
13661363
transitions: nextState.transitions,
13671364
};
13681365
const updateQueue: UpdateQueue<RootState> = (workInProgress.updateQueue: any);
@@ -1980,6 +1977,7 @@ function mountSuspenseOffscreenState(renderLanes: Lanes): OffscreenState {
19801977
return {
19811978
baseLanes: renderLanes,
19821979
cachePool: getSuspendedCache(),
1980+
transitions: null,
19831981
};
19841982
}
19851983

@@ -2014,6 +2012,7 @@ function updateSuspenseOffscreenState(
20142012
return {
20152013
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes),
20162014
cachePool,
2015+
transitions: prevOffscreenState.transitions,
20172016
};
20182017
}
20192018

@@ -3580,9 +3579,6 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
35803579
const cache: Cache = current.memoizedState.cache;
35813580
pushCacheProvider(workInProgress, cache);
35823581
}
3583-
if (enableTransitionTracing) {
3584-
workInProgress.memoizedState.transitions = getWorkInProgressTransitions();
3585-
}
35863582
resetHydrationState();
35873583
break;
35883584
case HostComponent:

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -2725,9 +2725,8 @@ function commitPassiveMountOnFiber(
27252725
}
27262726

27272727
if (enableTransitionTracing) {
2728-
const transitions = finishedWork.memoizedState.transitions;
2729-
if (transitions !== null) {
2730-
transitions.forEach(transition => {
2728+
if (committedTransitions !== null) {
2729+
committedTransitions.forEach(transition => {
27312730
// TODO(luna) Do we want to log TransitionStart in the startTransition callback instead?
27322731
addTransitionStartCallbackToPendingTransition({
27332732
transitionName: transition.name,

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import type {
1515
} from './ReactInternalTypes';
1616
import type {RootTag} from './ReactRootTags';
1717
import type {Cache} from './ReactFiberCacheComponent.old';
18-
import type {Transition} from './ReactFiberTracingMarkerComponent.old';
18+
import type {
19+
PendingSuspenseBoundaries,
20+
Transition,
21+
} from './ReactFiberTracingMarkerComponent.old';
1922

2023
import {noTimeout, supportsHydration} from './ReactFiberHostConfig';
2124
import {createHostRootFiber} from './ReactFiber.old';
@@ -42,7 +45,8 @@ export type RootState = {
4245
element: any,
4346
isDehydrated: boolean,
4447
cache: Cache,
45-
transitions: Array<Transition> | null,
48+
pendingSuspenseBoundaries: PendingSuspenseBoundaries | null,
49+
transitions: Set<Transition> | null,
4650
};
4751

4852
function FiberRootNode(
@@ -184,6 +188,7 @@ export function createFiberRoot(
184188
isDehydrated: hydrate,
185189
cache: initialCache,
186190
transitions: null,
191+
pendingSuspenseBoundaries: null,
187192
};
188193
uninitializedFiber.memoizedState = initialState;
189194
} else {
@@ -192,6 +197,7 @@ export function createFiberRoot(
192197
isDehydrated: hydrate,
193198
cache: (null: any), // not enabled yet
194199
transitions: null,
200+
pendingSuspenseBoundaries: null,
195201
};
196202
uninitializedFiber.memoizedState = initialState;
197203
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export type SuspenseProps = {|
2929
suspenseCallback?: (Set<Wakeable> | null) => mixed,
3030

3131
unstable_expectedLoadTime?: number,
32+
name?: string,
3233
|};
3334

3435
// A null SuspenseState represents an unsuspended normal Suspense boundary.

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

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
* @flow
88
*/
99

10-
import type {TransitionTracingCallbacks} from './ReactInternalTypes';
11-
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
10+
import type {TransitionTracingCallbacks, Fiber} from './ReactInternalTypes';
11+
import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
12+
1213
import {enableTransitionTracing} from 'shared/ReactFeatureFlags';
1314

1415
export type SuspenseInfo = {name: string | null};
@@ -34,10 +35,7 @@ export type BatchConfigTransition = {
3435
_updatedFibers?: Set<Fiber>,
3536
};
3637

37-
export type TransitionCallback = 0 | 1;
38-
39-
export const TransitionStart = 0;
40-
export const TransitionComplete = 1;
38+
export type PendingSuspenseBoundaries = Map<OffscreenInstance, SuspenseInfo>;
4139

4240
export function processTransitionCallbacks(
4341
pendingTransitions: PendingTransitionCallbacks,

0 commit comments

Comments
 (0)