Skip to content

Commit 88ef957

Browse files
authored
Fork ReactFiberLane (#20371)
This wasn't forked previously because Lane and associated types are opaque, and they leak into non-reconciler packages. So forking the type would also require forking all those other packages. But I really want to use the reconciler fork infra for lanes changes. So I made them no longer opaque. Another possible solution would be to add separate `new` and `old` fields to the Fiber type, like I did when migrating from expiration times. But that seems so excessive. This seems fine. But we should still treat them like they're opaque and only do lanes manipulation in the ReactFiberLane module. At least until the model stabilizes more. We'll just need to enforce this with discipline instead of with the type system.
1 parent e9860d4 commit 88ef957

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+944
-69
lines changed

packages/react-dom/src/events/ReactDOMEventListener.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree';
4141
import {
4242
enableLegacyFBSupport,
4343
decoupleUpdatePriorityFromScheduler,
44+
enableNewReconciler,
4445
} from 'shared/ReactFeatureFlags';
4546
import {
4647
UserBlockingEvent,
@@ -53,11 +54,27 @@ import {
5354
flushDiscreteUpdatesIfNeeded,
5455
discreteUpdates,
5556
} from './ReactDOMUpdateBatching';
57+
58+
import {
59+
InputContinuousLanePriority as InputContinuousLanePriority_old,
60+
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_old,
61+
setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_old,
62+
} from 'react-reconciler/src/ReactFiberLane.old';
5663
import {
57-
InputContinuousLanePriority,
58-
getCurrentUpdateLanePriority,
59-
setCurrentUpdateLanePriority,
60-
} from 'react-reconciler/src/ReactFiberLane';
64+
InputContinuousLanePriority as InputContinuousLanePriority_new,
65+
getCurrentUpdateLanePriority as getCurrentUpdateLanePriority_new,
66+
setCurrentUpdateLanePriority as setCurrentUpdateLanePriority_new,
67+
} from 'react-reconciler/src/ReactFiberLane.new';
68+
69+
const InputContinuousLanePriority = enableNewReconciler
70+
? InputContinuousLanePriority_new
71+
: InputContinuousLanePriority_old;
72+
const getCurrentUpdateLanePriority = enableNewReconciler
73+
? getCurrentUpdateLanePriority_new
74+
: getCurrentUpdateLanePriority_old;
75+
const setCurrentUpdateLanePriority = enableNewReconciler
76+
? setCurrentUpdateLanePriority_new
77+
: setCurrentUpdateLanePriority_old;
6178

6279
const {
6380
unstable_UserBlockingPriority: UserBlockingPriority,

packages/react-dom/src/events/ReactDOMEventReplaying.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
1212
import type {DOMEventName} from '../events/DOMEventNames';
1313
import type {EventSystemFlags} from './EventSystemFlags';
1414
import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
15-
import type {LanePriority} from 'react-reconciler/src/ReactFiberLane';
15+
import type {LanePriority} from 'react-reconciler/src/ReactFiberLane.old';
1616

1717
import {enableSelectiveHydration} from 'shared/ReactFeatureFlags';
1818
import {

packages/react-reconciler/src/DebugTracing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import type {Lane, Lanes} from './ReactFiberLane';
10+
import type {Lane, Lanes} from './ReactFiberLane.old';
1111
import type {Wakeable} from 'shared/ReactTypes';
1212

1313
import {enableDebugTracing} from 'shared/ReactFeatureFlags';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type {ReactElement} from 'shared/ReactElementType';
1111
import type {ReactPortal} from 'shared/ReactTypes';
1212
import type {Fiber} from './ReactInternalTypes';
13-
import type {Lanes} from './ReactFiberLane';
13+
import type {Lanes} from './ReactFiberLane.new';
1414

1515
import getComponentName from 'shared/getComponentName';
1616
import {Placement, Deletion} from './ReactFiberFlags';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type {ReactElement} from 'shared/ReactElementType';
1111
import type {ReactPortal} from 'shared/ReactTypes';
1212
import type {Fiber} from './ReactInternalTypes';
13-
import type {Lanes} from './ReactFiberLane';
13+
import type {Lanes} from './ReactFiberLane.old';
1414

1515
import getComponentName from 'shared/getComponentName';
1616
import {Placement, Deletion} from './ReactFiberFlags';

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {Fiber} from './ReactInternalTypes';
1818
import type {RootTag} from './ReactRootTags';
1919
import type {WorkTag} from './ReactWorkTags';
2020
import type {TypeOfMode} from './ReactTypeOfMode';
21-
import type {Lanes} from './ReactFiberLane';
21+
import type {Lanes} from './ReactFiberLane.new';
2222
import type {SuspenseInstance} from './ReactFiberHostConfig';
2323
import type {OffscreenProps} from './ReactFiberOffscreenComponent';
2424

@@ -63,7 +63,7 @@ import {
6363
resolveFunctionForHotReloading,
6464
resolveForwardRefForHotReloading,
6565
} from './ReactFiberHotReloading.new';
66-
import {NoLanes} from './ReactFiberLane';
66+
import {NoLanes} from './ReactFiberLane.new';
6767
import {
6868
NoMode,
6969
ConcurrentMode,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {Fiber} from './ReactInternalTypes';
1818
import type {RootTag} from './ReactRootTags';
1919
import type {WorkTag} from './ReactWorkTags';
2020
import type {TypeOfMode} from './ReactTypeOfMode';
21-
import type {Lanes} from './ReactFiberLane';
21+
import type {Lanes} from './ReactFiberLane.old';
2222
import type {SuspenseInstance} from './ReactFiberHostConfig';
2323
import type {OffscreenProps} from './ReactFiberOffscreenComponent';
2424

@@ -63,7 +63,7 @@ import {
6363
resolveFunctionForHotReloading,
6464
resolveForwardRefForHotReloading,
6565
} from './ReactFiberHotReloading.old';
66-
import {NoLanes} from './ReactFiberLane';
66+
import {NoLanes} from './ReactFiberLane.old';
6767
import {
6868
NoMode,
6969
ConcurrentMode,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
1111
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
1212
import type {Fiber} from './ReactInternalTypes';
1313
import type {FiberRoot} from './ReactInternalTypes';
14-
import type {Lanes, Lane} from './ReactFiberLane';
14+
import type {Lanes, Lane} from './ReactFiberLane.new';
1515
import type {MutableSource} from 'shared/ReactTypes';
1616
import type {
1717
SuspenseState,
@@ -113,7 +113,7 @@ import {
113113
removeLanes,
114114
mergeLanes,
115115
getBumpedLaneForHydration,
116-
} from './ReactFiberLane';
116+
} from './ReactFiberLane.new';
117117
import {
118118
ConcurrentMode,
119119
NoMode,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
1111
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
1212
import type {Fiber} from './ReactInternalTypes';
1313
import type {FiberRoot} from './ReactInternalTypes';
14-
import type {Lanes, Lane} from './ReactFiberLane';
14+
import type {Lanes, Lane} from './ReactFiberLane.old';
1515
import type {MutableSource} from 'shared/ReactTypes';
1616
import type {
1717
SuspenseState,
@@ -113,7 +113,7 @@ import {
113113
removeLanes,
114114
mergeLanes,
115115
getBumpedLaneForHydration,
116-
} from './ReactFiberLane';
116+
} from './ReactFiberLane.old';
117117
import {
118118
ConcurrentMode,
119119
NoMode,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import type {Fiber} from './ReactInternalTypes';
11-
import type {Lanes} from './ReactFiberLane';
11+
import type {Lanes} from './ReactFiberLane.new';
1212
import type {UpdateQueue} from './ReactUpdateQueue.new';
1313

1414
import * as React from 'react';
@@ -42,7 +42,7 @@ import {
4242
initializeUpdateQueue,
4343
cloneUpdateQueue,
4444
} from './ReactUpdateQueue.new';
45-
import {NoLanes} from './ReactFiberLane';
45+
import {NoLanes} from './ReactFiberLane.new';
4646
import {
4747
cacheContext,
4848
getMaskedContext,

0 commit comments

Comments
 (0)