Skip to content

Commit 88ef957

Browse files
authoredDec 4, 2020
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

+21-4
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

+1-1
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 {

0 commit comments

Comments
 (0)