Add `.old` prefix to reconciler modules
Andrew Clark committed
Apr 8, 2020 at 19:44 UTC
d686f3f16a796025ce32cfb431b70eef6de1934e
74 files changed
+840
-737
packages/legacy-events/PluginModuleType.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {
12
DispatchConfig,
13
ReactSyntheticEvent,
packages/legacy-events/ReactSyntheticEventType.js
+1
-1
@@ -8,7 +8,7 @@
8
* @flow
9
*/
10
11
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
11
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
12
import type {EventPriority} from 'shared/ReactTypes';
13
import type {TopLevelType} from './TopLevelEventTypes';
14
packages/react-debug-tools/src/ReactDebugHooks.js
+7
-4
@@ -17,12 +17,15 @@ import type {
17
ReactEventResponderListener,
18
ReactScopeMethods,
19
} from 'shared/ReactTypes';
20
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
20
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
21
import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
22
23
-import type {Hook, TimeoutConfig} from 'react-reconciler/src/ReactFiberHooks';
24
-import type {Dispatcher as DispatcherType} from 'react-reconciler/src/ReactFiberHooks';
25
-import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
23
+import type {
24
+ Hook,
25
+ TimeoutConfig,
26
+ Dispatcher as DispatcherType,
27
+} from 'react-reconciler/src/ReactFiberHooks.old';
28
+import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
29
import {NoMode} from 'react-reconciler/src/ReactTypeOfMode';
30
31
import ErrorStackParser from 'error-stack-parser';
packages/react-devtools-shared/src/backend/console.js
+1
-1
@@ -10,7 +10,7 @@
10
import {getInternalReactConstants} from './renderer';
11
import describeComponentFrame from './describeComponentFrame';
12
13
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
13
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
14
import type {ReactRenderer} from './types';
15
16
const APPEND_STACK_TO_METHODS = ['error', 'trace', 'warn'];
packages/react-devtools-shared/src/backend/renderer.js
+1
-1
@@ -50,7 +50,7 @@ import {
50
registerRenderer as registerRendererWithConsole,
51
} from './console';
52
53
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
53
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
54
import type {
55
ChangeDescription,
56
CommitDataBackend,
packages/react-devtools-shared/src/backend/types.js
+1
-1
@@ -9,7 +9,7 @@
9
10
import type {ReactContext} from 'shared/ReactTypes';
11
import type {Source} from 'shared/ReactElementType';
12
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
12
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
13
import type {
14
ComponentFilter,
15
ElementType,
packages/react-dom/src/client/ReactDOMComponentTree.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {
12
Container,
13
TextInstance,
packages/react-dom/src/client/ReactDOMRoot.js
+1
-1
@@ -12,7 +12,7 @@ import type {RootTag} from 'react-reconciler/src/ReactRootTags';
12
import type {ReactNodeList} from 'shared/ReactTypes';
13
// TODO: This type is shared between the reconciler and ReactDOM, but will
14
// eventually be lifted out to the renderer.
15
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
15
+import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
16
import {findHostInstanceWithNoPortals} from 'react-reconciler/src/ReactFiberReconciler';
17
18
export type RootType = {
packages/react-dom/src/events/DOMLegacyEventPluginSystem.js
+1
-1
@@ -11,7 +11,7 @@ import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
11
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
12
import type {ElementListenerMap} from '../events/DOMEventListenerMap';
13
import type {EventSystemFlags} from './EventSystemFlags';
14
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
14
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
15
import type {PluginModule} from 'legacy-events/PluginModuleType';
16
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
17
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
packages/react-dom/src/events/DOMModernPluginEventSystem.js
+1
-1
@@ -15,7 +15,7 @@ import type {
15
} from '../events/DOMEventListenerMap';
16
import type {EventSystemFlags} from './EventSystemFlags';
17
import type {EventPriority, ReactScopeMethods} from 'shared/ReactTypes';
18
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
18
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
19
import type {PluginModule} from 'legacy-events/PluginModuleType';
20
import type {
21
ReactSyntheticEvent,
packages/react-dom/src/events/DeprecatedDOMEventResponderSystem.js
+1
-1
@@ -31,7 +31,7 @@ import {
31
flushDiscreteUpdatesIfNeeded,
32
executeUserEventHandler,
33
} from './ReactDOMUpdateBatching';
34
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
34
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
35
import {enableDeprecatedFlareAPI} from 'shared/ReactFeatureFlags';
36
import invariant from 'shared/invariant';
37
packages/react-dom/src/events/ReactDOMEventListener.js
+1
-1
@@ -9,7 +9,7 @@
9
10
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
11
import type {EventPriority} from 'shared/ReactTypes';
12
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
12
+import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
13
import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
14
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
15
packages/react-dom/src/events/ReactDOMEventReplaying.js
+1
-1
@@ -12,7 +12,7 @@ import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
12
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
13
import type {ElementListenerMap} from '../events/DOMEventListenerMap';
14
import type {EventSystemFlags} from './EventSystemFlags';
15
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
15
+import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
16
17
import {
18
enableDeprecatedFlareAPI,
packages/react-dom/src/events/SimpleEventPlugin.js
+1
-1
@@ -12,7 +12,7 @@ import type {
12
DOMTopLevelEventType,
13
} from 'legacy-events/TopLevelEventTypes';
14
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
15
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
15
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
16
import type {PluginModule} from 'legacy-events/PluginModuleType';
17
import type {EventSystemFlags} from './EventSystemFlags';
18
packages/react-dom/src/events/accumulateEnterLeaveListeners.js
+2
-2
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
12
13
import {HostComponent} from 'react-reconciler/src/ReactWorkTags';
@@ -82,7 +82,7 @@ function accumulateEnterLeaveListenersForEvent(
82
return;
83
}
84
const dispatchListeners = [];
85
- const dispatchInstances = [];
85
+ const dispatchInstances: Array<Fiber | null> = [];
86
const dispatchCurrentTargets = [];
87
88
let instance = target;
packages/react-dom/src/events/accumulateEventTargetListeners.js
+2
-1
@@ -7,6 +7,7 @@
7
* @flow
8
*/
9
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
12
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
13
@@ -17,7 +18,7 @@ export default function accumulateEventTargetListeners(
18
currentTarget: EventTarget,
19
): void {
20
const dispatchListeners = [];
20
- const dispatchInstances = [];
21
+ const dispatchInstances: Array<Fiber | null> = [];
22
const dispatchCurrentTargets = [];
23
24
const eventTypeMap = eventTargetEventListenerStore.get(currentTarget);
packages/react-dom/src/events/accumulateTwoPhaseListeners.js
+2
-1
@@ -7,6 +7,7 @@
7
* @flow
8
*/
9
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
12
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
13
@@ -30,7 +31,7 @@ export default function accumulateTwoPhaseListeners(
31
): void {
32
const phasedRegistrationNames = event.dispatchConfig.phasedRegistrationNames;
33
const dispatchListeners = [];
33
- const dispatchInstances = [];
34
+ const dispatchInstances: Array<Fiber | null> = [];
35
const dispatchCurrentTargets = [];
36
37
const {bubbled, captured} = phasedRegistrationNames;
packages/react-dom/src/events/getListener.js
+1
-1
@@ -6,7 +6,7 @@
6
* @flow
7
*/
8
9
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
9
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10
import type {Props} from '../client/ReactDOMHostConfig';
11
12
import invariant from 'shared/invariant';
packages/react-dom/src/server/ReactPartialRendererHooks.js
+2
-2
@@ -10,7 +10,7 @@
10
import type {
11
Dispatcher as DispatcherType,
12
TimeoutConfig,
13
-} from 'react-reconciler/src/ReactFiberHooks';
13
+} from 'react-reconciler/src/ReactFiberHooks.old';
14
import type {ThreadID} from './ReactThreadIDAllocator';
15
import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
16
@@ -21,7 +21,7 @@ import type {
21
ReactContext,
22
ReactEventResponderListener,
23
} from 'shared/ReactTypes';
24
-import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
24
+import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
25
import type {ReactDOMListenerMap} from '../shared/ReactDOMTypes';
26
27
import {validateContextBounds} from './ReactPartialRendererContext';
packages/react-native-renderer/src/ReactFabricEventEmitter.js
+1
-1
@@ -8,7 +8,7 @@
8
*/
9
10
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
11
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
11
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
12
import type {PluginModule} from 'legacy-events/PluginModuleType';
13
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
14
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
packages/react-native-renderer/src/ReactNativeEventEmitter.js
+1
-1
@@ -8,7 +8,7 @@
8
*/
9
10
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
11
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
11
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
12
import type {PluginModule} from 'legacy-events/PluginModuleType';
13
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
14
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
packages/react-native-renderer/src/ReactNativeFiberInspector.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
import type {TouchedViewDataAtPoint, InspectorData} from './ReactNativeTypes';
12
13
import {
packages/react-native-renderer/src/ReactNativeGetListener.js
+1
-1
@@ -6,7 +6,7 @@
6
* @flow
7
*/
8
9
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
9
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10
11
import invariant from 'shared/invariant';
12
import {getFiberCurrentPropsFromNode} from 'legacy-events/EventPluginUtils';
packages/react-noop-renderer/src/createReactNoop.js
+1
-1
@@ -14,7 +14,7 @@
14
* environment.
15
*/
16
17
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
17
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
18
import type {UpdateQueue} from 'react-reconciler/src/ReactUpdateQueue';
19
import type {ReactNodeList} from 'shared/ReactTypes';
20
import type {RootTag} from 'react-reconciler/src/ReactRootTags';
packages/react-reconciler/src/ReactCapturedValue.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
13
packages/react-reconciler/src/ReactChildFiber.old.js
renamed
+5
-5
@@ -11,8 +11,8 @@ import type {ReactElement} from 'shared/ReactElementType';
11
import type {ReactPortal} from 'shared/ReactTypes';
12
import type {BlockComponent} from 'react/src/ReactBlock';
13
import type {LazyComponent} from 'react/src/ReactLazy';
14
-import type {Fiber} from './ReactFiber';
15
-import type {ExpirationTime} from './ReactFiberExpirationTime';
14
+import type {Fiber} from './ReactFiber.old';
15
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
16
17
import getComponentName from 'shared/getComponentName';
18
import {Placement, Deletion} from './ReactSideEffectTags';
@@ -42,11 +42,11 @@ import {
42
createFiberFromFragment,
43
createFiberFromText,
44
createFiberFromPortal,
45
-} from './ReactFiber';
46
-import {emptyRefsObject} from './ReactFiberClassComponent';
45
+} from './ReactFiber.old';
46
+import {emptyRefsObject} from './ReactFiberClassComponent.old';
47
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
48
import {getCurrentFiberStackInDev} from './ReactCurrentFiber';
49
-import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading';
49
+import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.old';
50
import {StrictMode} from './ReactTypeOfMode';
51
52
let didWarnAboutMaps;
packages/react-reconciler/src/ReactCurrentFiber.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
import ReactSharedInternals from 'shared/ReactSharedInternals';
13
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
packages/react-reconciler/src/ReactFiber.old.js
renamed
+9
-9
@@ -17,14 +17,14 @@ import type {
17
ReactFundamentalComponent,
18
ReactScope,
19
} from 'shared/ReactTypes';
20
-import type {RootTag} from 'react-reconciler/src/ReactRootTags';
20
+import type {RootTag} from './ReactRootTags';
21
import type {WorkTag} from './ReactWorkTags';
22
import type {TypeOfMode} from './ReactTypeOfMode';
23
import type {SideEffectTag} from './ReactSideEffectTags';
24
-import type {ExpirationTime} from './ReactFiberExpirationTime';
25
-import type {UpdateQueue} from './ReactUpdateQueue';
26
-import type {ContextDependency} from './ReactFiberNewContext';
27
-import type {HookType} from './ReactFiberHooks';
24
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
25
+import type {UpdateQueue} from './ReactUpdateQueue.old';
26
+import type {ContextDependency} from './ReactFiberNewContext.old';
27
+import type {HookType} from './ReactFiberHooks.old';
28
import type {SuspenseInstance} from './ReactFiberHostConfig';
29
30
import invariant from 'shared/invariant';
@@ -36,7 +36,7 @@ import {
36
throwEarlyForMysteriousError,
37
} from 'shared/ReactFeatureFlags';
38
import {NoEffect, Placement} from './ReactSideEffectTags';
39
-import {ConcurrentRoot, BlockingRoot} from 'react-reconciler/src/ReactRootTags';
39
+import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
40
import {
41
IndeterminateComponent,
42
ClassComponent,
@@ -63,13 +63,13 @@ import {
63
} from './ReactWorkTags';
64
import getComponentName from 'shared/getComponentName';
65
66
-import {isDevToolsPresent} from './ReactFiberDevToolsHook';
66
+import {isDevToolsPresent} from './ReactFiberDevToolsHook.old';
67
import {
68
resolveClassForHotReloading,
69
resolveFunctionForHotReloading,
70
resolveForwardRefForHotReloading,
71
-} from './ReactFiberHotReloading';
72
-import {NoWork} from './ReactFiberExpirationTime';
71
+} from './ReactFiberHotReloading.old';
72
+import {NoWork} from './ReactFiberExpirationTime.old';
73
import {
74
NoMode,
75
ConcurrentMode,
packages/react-reconciler/src/ReactFiberBeginWork.old.js
renamed
+22
-22
@@ -10,15 +10,15 @@
10
import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
11
import type {BlockComponent} from 'react/src/ReactBlock';
12
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
13
-import type {Fiber} from './ReactFiber';
14
-import type {FiberRoot} from './ReactFiberRoot';
15
-import type {ExpirationTime} from './ReactFiberExpirationTime';
13
+import type {Fiber} from './ReactFiber.old';
14
+import type {FiberRoot} from './ReactFiberRoot.old';
15
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
16
import type {
17
SuspenseState,
18
SuspenseListRenderState,
19
SuspenseListTailMode,
20
-} from './ReactFiberSuspenseComponent';
21
-import type {SuspenseContext} from './ReactFiberSuspenseContext';
20
+} from './ReactFiberSuspenseComponent.old';
21
+import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
22
23
import checkPropTypes from 'shared/checkPropTypes';
24
@@ -73,7 +73,7 @@ import {
73
import invariant from 'shared/invariant';
74
import shallowEqual from 'shared/shallowEqual';
75
import getComponentName from 'shared/getComponentName';
76
-import ReactStrictModeWarnings from './ReactStrictModeWarnings';
76
+import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
77
import {REACT_LAZY_TYPE, getIteratorFn} from 'shared/ReactSymbols';
78
import {
79
getCurrentFiberOwnerNameInDevOrNull,
@@ -83,24 +83,24 @@ import {
83
resolveFunctionForHotReloading,
84
resolveForwardRefForHotReloading,
85
resolveClassForHotReloading,
86
-} from './ReactFiberHotReloading';
86
+} from './ReactFiberHotReloading.old';
87
88
import {
89
mountChildFibers,
90
reconcileChildFibers,
91
cloneChildFibers,
92
-} from './ReactChildFiber';
92
+} from './ReactChildFiber.old';
93
import {
94
processUpdateQueue,
95
cloneUpdateQueue,
96
initializeUpdateQueue,
97
-} from './ReactUpdateQueue';
97
+} from './ReactUpdateQueue.old';
98
import {
99
NoWork,
100
Never,
101
Sync,
102
computeAsyncExpiration,
103
-} from './ReactFiberExpirationTime';
103
+} from './ReactFiberExpirationTime.old';
104
import {
105
ConcurrentMode,
106
NoMode,
@@ -117,7 +117,7 @@ import {
117
} from './ReactFiberHostConfig';
118
import type {SuspenseInstance} from './ReactFiberHostConfig';
119
import {shouldSuspend} from './ReactFiberReconciler';
120
-import {pushHostContext, pushHostContainer} from './ReactFiberHostContext';
120
+import {pushHostContext, pushHostContainer} from './ReactFiberHostContext.old';
121
import {
122
suspenseStackCursor,
123
pushSuspenseContext,
@@ -127,8 +127,8 @@ import {
127
setDefaultShallowSuspenseContext,
128
addSubtreeSuspenseContext,
129
setShallowSuspenseContext,
130
-} from './ReactFiberSuspenseContext';
131
-import {findFirstSuspended} from './ReactFiberSuspenseComponent';
130
+} from './ReactFiberSuspenseContext.old';
131
+import {findFirstSuspended} from './ReactFiberSuspenseComponent.old';
132
import {
133
pushProvider,
134
propagateContextChange,
@@ -136,9 +136,9 @@ import {
136
prepareToReadContext,
137
calculateChangedBits,
138
scheduleWorkOnParentPath,
139
-} from './ReactFiberNewContext';
140
-import {renderWithHooks, bailoutHooks} from './ReactFiberHooks';
141
-import {stopProfilerTimerIfRunning} from './ReactProfilerTimer';
139
+} from './ReactFiberNewContext.old';
140
+import {renderWithHooks, bailoutHooks} from './ReactFiberHooks.old';
141
+import {stopProfilerTimerIfRunning} from './ReactProfilerTimer.old';
142
import {
143
getMaskedContext,
144
getUnmaskedContext,
@@ -147,14 +147,14 @@ import {
147
isContextProvider as isLegacyContextProvider,
148
pushTopLevelContextObject,
149
invalidateContextProvider,
150
-} from './ReactFiberContext';
150
+} from './ReactFiberContext.old';
151
import {
152
enterHydrationState,
153
reenterHydrationStateFromDehydratedSuspenseInstance,
154
resetHydrationState,
155
tryToClaimNextHydratableInstance,
156
warnIfHydrating,
157
-} from './ReactFiberHydrationContext';
157
+} from './ReactFiberHydrationContext.old';
158
import {
159
adoptClassInstance,
160
applyDerivedStateFromProps,
@@ -162,15 +162,15 @@ import {
162
mountClassInstance,
163
resumeMountClassInstance,
164
updateClassInstance,
165
-} from './ReactFiberClassComponent';
166
-import {resolveDefaultProps} from './ReactFiberLazyComponent';
165
+} from './ReactFiberClassComponent.old';
166
+import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
167
import {
168
resolveLazyComponentTag,
169
createFiberFromTypeAndProps,
170
createFiberFromFragment,
171
createWorkInProgress,
172
isSimpleFunctionComponent,
173
-} from './ReactFiber';
173
+} from './ReactFiber.old';
174
import {
175
markSpawnedWork,
176
requestCurrentTimeForUpdate,
@@ -179,7 +179,7 @@ import {
179
renderDidSuspendDelayIfPossible,
180
markUnprocessedUpdateTime,
181
getWorkInProgressRoot,
182
-} from './ReactFiberWorkLoop';
182
+} from './ReactFiberWorkLoop.old';
183
184
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
185
packages/react-reconciler/src/ReactFiberClassComponent.old.js
renamed
+12
-12
@@ -7,9 +7,9 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {ExpirationTime} from './ReactFiberExpirationTime';
12
-import type {UpdateQueue} from './ReactUpdateQueue';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
12
+import type {UpdateQueue} from './ReactUpdateQueue.old';
13
14
import * as React from 'react';
15
import {Update, Snapshot} from './ReactSideEffectTags';
@@ -18,15 +18,15 @@ import {
18
disableLegacyContext,
19
warnAboutDeprecatedLifecycles,
20
} from 'shared/ReactFeatureFlags';
21
-import ReactStrictModeWarnings from './ReactStrictModeWarnings';
22
-import {isMounted} from 'react-reconciler/src/ReactFiberTreeReflection';
21
+import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
22
+import {isMounted} from './ReactFiberTreeReflection';
23
import {get as getInstance, set as setInstance} from 'shared/ReactInstanceMap';
24
import shallowEqual from 'shared/shallowEqual';
25
import getComponentName from 'shared/getComponentName';
26
import invariant from 'shared/invariant';
27
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
28
29
-import {resolveDefaultProps} from './ReactFiberLazyComponent';
29
+import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
30
import {StrictMode} from './ReactTypeOfMode';
31
32
import {
@@ -39,22 +39,22 @@ import {
39
ForceUpdate,
40
initializeUpdateQueue,
41
cloneUpdateQueue,
42
-} from './ReactUpdateQueue';
43
-import {NoWork} from './ReactFiberExpirationTime';
42
+} from './ReactUpdateQueue.old';
43
+import {NoWork} from './ReactFiberExpirationTime.old';
44
import {
45
cacheContext,
46
getMaskedContext,
47
getUnmaskedContext,
48
hasContextChanged,
49
emptyContextObject,
50
-} from './ReactFiberContext';
51
-import {readContext} from './ReactFiberNewContext';
50
+} from './ReactFiberContext.old';
51
+import {readContext} from './ReactFiberNewContext.old';
52
import {
53
requestCurrentTimeForUpdate,
54
computeExpirationForFiber,
55
scheduleUpdateOnFiber,
56
-} from './ReactFiberWorkLoop';
57
-import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
56
+} from './ReactFiberWorkLoop.old';
57
+import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
58
59
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
60
packages/react-reconciler/src/ReactFiberCommitWork.old.js
renamed
+17
-14
@@ -15,13 +15,13 @@ import type {
15
ChildSet,
16
UpdatePayload,
17
} from './ReactFiberHostConfig';
18
-import type {Fiber} from './ReactFiber';
19
-import type {FiberRoot} from './ReactFiberRoot';
20
-import type {ExpirationTime} from './ReactFiberExpirationTime';
21
-import type {SuspenseState} from './ReactFiberSuspenseComponent';
22
-import type {FunctionComponentUpdateQueue} from './ReactFiberHooks';
18
+import type {Fiber} from './ReactFiber.old';
19
+import type {FiberRoot} from './ReactFiberRoot.old';
20
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
21
+import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
22
+import type {FunctionComponentUpdateQueue} from './ReactFiberHooks.old';
23
import type {Wakeable} from 'shared/ReactTypes';
24
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
24
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
25
26
import {unstable_wrap as Schedule_tracing_wrap} from 'scheduler/tracing';
27
import {
@@ -72,18 +72,18 @@ import {
72
import getComponentName from 'shared/getComponentName';
73
import invariant from 'shared/invariant';
74
75
-import {onCommitUnmount} from './ReactFiberDevToolsHook';
75
+import {onCommitUnmount} from './ReactFiberDevToolsHook.old';
76
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
77
-import {resolveDefaultProps} from './ReactFiberLazyComponent';
77
+import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
78
import {
79
getCommitTime,
80
recordLayoutEffectDuration,
81
recordPassiveEffectDuration,
82
startLayoutEffectTimer,
83
startPassiveEffectTimer,
84
-} from './ReactProfilerTimer';
84
+} from './ReactProfilerTimer.old';
85
import {ProfileMode} from './ReactTypeOfMode';
86
-import {commitUpdateQueue} from './ReactUpdateQueue';
86
+import {commitUpdateQueue} from './ReactUpdateQueue.old';
87
import {
88
getPublicInstance,
89
supportsMutation,
@@ -120,19 +120,22 @@ import {
120
enqueuePendingPassiveHookEffectMount,
121
enqueuePendingPassiveHookEffectUnmount,
122
enqueuePendingPassiveProfilerEffect,
123
-} from './ReactFiberWorkLoop';
123
+} from './ReactFiberWorkLoop.old';
124
import {
125
NoEffect as NoHookEffect,
126
HasEffect as HookHasEffect,
127
Layout as HookLayout,
128
Passive as HookPassive,
129
} from './ReactHookEffectTags';
130
-import {didWarnAboutReassigningProps} from './ReactFiberBeginWork';
131
-import {runWithPriority, NormalPriority} from './SchedulerWithReactIntegration';
130
+import {didWarnAboutReassigningProps} from './ReactFiberBeginWork.old';
131
+import {
132
+ runWithPriority,
133
+ NormalPriority,
134
+} from './SchedulerWithReactIntegration.old';
135
import {
136
updateDeprecatedEventListeners,
137
unmountDeprecatedResponderListeners,
135
-} from './ReactFiberDeprecatedEvents';
138
+} from './ReactFiberDeprecatedEvents.old';
139
140
let didWarnAboutUndefinedSnapshotBeforeUpdate: Set<mixed> | null = null;
141
if (__DEV__) {
packages/react-reconciler/src/ReactFiberCompleteWork.old.js
renamed
+19
-19
@@ -7,13 +7,13 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {ExpirationTime} from './ReactFiberExpirationTime';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
12
import type {
13
ReactFundamentalComponentInstance,
14
ReactScopeInstance,
15
} from 'shared/ReactTypes';
16
-import type {FiberRoot} from './ReactFiberRoot';
16
+import type {FiberRoot} from './ReactFiberRoot.old';
17
import type {
18
Instance,
19
Type,
@@ -24,11 +24,11 @@ import type {
24
import type {
25
SuspenseState,
26
SuspenseListRenderState,
27
-} from './ReactFiberSuspenseComponent';
28
-import type {SuspenseContext} from './ReactFiberSuspenseContext';
29
-import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource';
27
+} from './ReactFiberSuspenseComponent.old';
28
+import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
29
+import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
30
31
-import {now} from './SchedulerWithReactIntegration';
31
+import {now} from './SchedulerWithReactIntegration.old';
32
33
import {
34
IndeterminateComponent,
@@ -88,7 +88,7 @@ import {
88
popHostContext,
89
getHostContext,
90
popHostContainer,
91
-} from './ReactFiberHostContext';
91
+} from './ReactFiberHostContext.old';
92
import {
93
suspenseStackCursor,
94
InvisibleParentSuspenseContext,
@@ -98,21 +98,21 @@ import {
98
setShallowSuspenseContext,
99
ForceSuspenseFallback,
100
setDefaultShallowSuspenseContext,
101
-} from './ReactFiberSuspenseContext';
102
-import {findFirstSuspended} from './ReactFiberSuspenseComponent';
101
+} from './ReactFiberSuspenseContext.old';
102
+import {findFirstSuspended} from './ReactFiberSuspenseComponent.old';
103
import {
104
isContextProvider as isLegacyContextProvider,
105
popContext as popLegacyContext,
106
popTopLevelContextObject as popTopLevelLegacyContextObject,
107
-} from './ReactFiberContext';
108
-import {popProvider} from './ReactFiberNewContext';
107
+} from './ReactFiberContext.old';
108
+import {popProvider} from './ReactFiberNewContext.old';
109
import {
110
prepareToHydrateHostInstance,
111
prepareToHydrateHostTextInstance,
112
prepareToHydrateHostSuspenseInstance,
113
popHydrationState,
114
resetHydrationState,
115
-} from './ReactFiberHydrationContext';
115
+} from './ReactFiberHydrationContext.old';
116
import {
117
enableSchedulerTracing,
118
enableSuspenseCallback,
@@ -127,12 +127,12 @@ import {
127
renderDidSuspend,
128
renderDidSuspendDelayIfPossible,
129
renderHasNotSuspendedYet,
130
-} from './ReactFiberWorkLoop';
131
-import {createFundamentalStateInstance} from './ReactFiberFundamental';
132
-import {Never} from './ReactFiberExpirationTime';
133
-import {resetChildFibers} from './ReactChildFiber';
134
-import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents';
135
-import {createScopeMethods} from './ReactFiberScope';
130
+} from './ReactFiberWorkLoop.old';
131
+import {createFundamentalStateInstance} from './ReactFiberFundamental.old';
132
+import {Never} from './ReactFiberExpirationTime.old';
133
+import {resetChildFibers} from './ReactChildFiber.old';
134
+import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents.old';
135
+import {createScopeMethods} from './ReactFiberScope.old';
136
137
function markUpdate(workInProgress: Fiber) {
138
// Tag the fiber with an update effect. This turns a Placement into
packages/react-reconciler/src/ReactFiberComponentStack.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
import {
13
HostComponent,
packages/react-reconciler/src/ReactFiberContext.old.js
renamed
+4
-4
@@ -7,17 +7,17 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {StackCursor} from './ReactFiberStack';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {StackCursor} from './ReactFiberStack.old';
12
13
-import {isFiberMounted} from 'react-reconciler/src/ReactFiberTreeReflection';
13
+import {isFiberMounted} from './ReactFiberTreeReflection';
14
import {disableLegacyContext} from 'shared/ReactFeatureFlags';
15
import {ClassComponent, HostRoot} from './ReactWorkTags';
16
import getComponentName from 'shared/getComponentName';
17
import invariant from 'shared/invariant';
18
import checkPropTypes from 'shared/checkPropTypes';
19
20
-import {createCursor, push, pop} from './ReactFiberStack';
20
+import {createCursor, push, pop} from './ReactFiberStack.old';
21
22
let warnedAboutMissingGetChildContext;
23
packages/react-reconciler/src/ReactFiberDeprecatedEvents.old.js
renamed
+2
-2
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {Container, Instance} from './ReactFiberHostConfig';
12
import type {
13
ReactEventResponder,
@@ -19,7 +19,7 @@ import {
19
DEPRECATED_mountResponderInstance,
20
DEPRECATED_unmountResponderInstance,
21
} from './ReactFiberHostConfig';
22
-import {NoWork} from './ReactFiberExpirationTime';
22
+import {NoWork} from './ReactFiberExpirationTime.old';
23
24
import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
25
packages/react-reconciler/src/ReactFiberDevToolsHook.old.js
renamed
+5
-5
@@ -8,12 +8,12 @@
8
*/
9
10
import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
11
-import {getCurrentTime} from './ReactFiberWorkLoop';
12
-import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime';
11
+import {getCurrentTime} from './ReactFiberWorkLoop.old';
12
+import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime.old';
13
14
-import type {Fiber} from './ReactFiber';
15
-import type {FiberRoot} from './ReactFiberRoot';
16
-import type {ExpirationTime} from './ReactFiberExpirationTime';
14
+import type {Fiber} from './ReactFiber.old';
15
+import type {FiberRoot} from './ReactFiberRoot.old';
16
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
17
import type {ReactNodeList} from 'shared/ReactTypes';
18
19
import {DidCapture} from './ReactSideEffectTags';
packages/react-reconciler/src/ReactFiberErrorDialog.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {CapturedValue} from './ReactCapturedValue';
12
13
// This module is forked in different environments.
packages/react-reconciler/src/ReactFiberErrorLogger.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {CapturedValue} from './ReactCapturedValue';
12
13
import {showErrorDialog} from './ReactFiberErrorDialog';
packages/react-reconciler/src/ReactFiberExpirationTime.old.js
renamed
+2
-2
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
10
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
11
12
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
13
@@ -16,7 +16,7 @@ import {
16
UserBlockingPriority,
17
NormalPriority,
18
IdlePriority,
19
-} from './SchedulerWithReactIntegration';
19
+} from './SchedulerWithReactIntegration.old';
20
21
export type ExpirationTime = number;
22
packages/react-reconciler/src/ReactFiberFundamental.old.js
renamed
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {
12
ReactFundamentalImpl,
13
ReactFundamentalComponentInstance,
packages/react-reconciler/src/ReactFiberHooks.old.js
renamed
+16
-16
@@ -16,12 +16,12 @@ import type {
16
ReactEventResponderListener,
17
ReactScopeMethods,
18
} from 'shared/ReactTypes';
19
-import type {Fiber} from './ReactFiber';
20
-import type {ExpirationTime} from './ReactFiberExpirationTime';
19
+import type {Fiber} from './ReactFiber.old';
20
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
21
import type {HookEffectTag} from './ReactHookEffectTags';
22
-import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
23
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
24
-import type {FiberRoot} from './ReactFiberRoot';
22
+import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
23
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
24
+import type {FiberRoot} from './ReactFiberRoot.old';
25
import type {
26
OpaqueIDType,
27
ReactListenerEvent,
@@ -32,11 +32,11 @@ import type {
32
import ReactSharedInternals from 'shared/ReactSharedInternals';
33
import {enableUseEventAPI} from 'shared/ReactFeatureFlags';
34
35
-import {markRootExpiredAtTime} from './ReactFiberRoot';
36
-import {NoWork, Sync} from './ReactFiberExpirationTime';
35
+import {markRootExpiredAtTime} from './ReactFiberRoot.old';
36
+import {NoWork, Sync} from './ReactFiberExpirationTime.old';
37
import {NoMode, BlockingMode} from './ReactTypeOfMode';
38
-import {readContext} from './ReactFiberNewContext';
39
-import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents';
38
+import {readContext} from './ReactFiberNewContext.old';
39
+import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents.old';
40
import {
41
Update as UpdateEffect,
42
Passive as PassiveEffect,
@@ -57,7 +57,7 @@ import {
57
warnIfNotScopedWithMatchingAct,
58
markRenderEventTimeAndConfig,
59
markUnprocessedUpdateTime,
60
-} from './ReactFiberWorkLoop';
60
+} from './ReactFiberWorkLoop.old';
61
import {
62
registerEvent,
63
mountEventListener as mountHostEventListener,
@@ -68,15 +68,15 @@ import {
68
import invariant from 'shared/invariant';
69
import getComponentName from 'shared/getComponentName';
70
import is from 'shared/objectIs';
71
-import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork';
72
-import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
71
+import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
72
+import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
73
import {
74
UserBlockingPriority,
75
NormalPriority,
76
runWithPriority,
77
getCurrentPriorityLevel,
78
-} from './SchedulerWithReactIntegration';
79
-import {getIsHydrating} from './ReactFiberHydrationContext';
78
+} from './SchedulerWithReactIntegration.old';
79
+import {getIsHydrating} from './ReactFiberHydrationContext.old';
80
import {
81
makeClientId,
82
makeClientIdInDEV,
@@ -89,8 +89,8 @@ import {
89
setPendingExpirationTime,
90
setWorkInProgressVersion,
91
warnAboutMultipleRenderersDEV,
92
-} from './ReactMutableSource';
93
-import {getRootHostContainer} from './ReactFiberHostContext';
92
+} from './ReactMutableSource.old';
93
+import {getRootHostContainer} from './ReactFiberHostContext.old';
94
import {getIsRendering} from './ReactCurrentFiber';
95
96
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
packages/react-reconciler/src/ReactFiberHostContext.old.js
renamed
+3
-3
@@ -7,14 +7,14 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {StackCursor} from './ReactFiberStack';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {StackCursor} from './ReactFiberStack.old';
12
import type {Container, HostContext} from './ReactFiberHostConfig';
13
14
import invariant from 'shared/invariant';
15
16
import {getChildHostContext, getRootHostContext} from './ReactFiberHostConfig';
17
-import {createCursor, push, pop} from './ReactFiberStack';
17
+import {createCursor, push, pop} from './ReactFiberStack.old';
18
19
declare class NoContextT {}
20
const NO_CONTEXT: NoContextT = ({}: any);
packages/react-reconciler/src/ReactFiberHotReloading.js
+60
-470
@@ -7,476 +7,66 @@
7
* @flow
8
*/
9
10
-import type {ReactElement} from 'shared/ReactElementType';
11
-import type {Fiber} from './ReactFiber';
12
-import type {FiberRoot} from './ReactFiberRoot';
13
-import type {Instance} from './ReactFiberHostConfig';
14
-import type {ReactNodeList} from 'shared/ReactTypes';
10
+import {enableNewReconciler} from 'shared/ReactFeatureFlags';
11
+
12
+export type {
13
+ Family,
14
+ RefreshUpdate,
15
+ SetRefreshHandler,
16
+ ScheduleRefresh,
17
+ ScheduleRoot,
18
+ FindHostInstancesForRefresh,
19
+} from './ReactFiberHotReloading';
20
21
import {
17
- flushSync,
18
- scheduleUpdateOnFiber,
19
- flushPassiveEffects,
20
-} from './ReactFiberWorkLoop';
21
-import {updateContainer, syncUpdates} from './ReactFiberReconciler';
22
-import {emptyContextObject} from './ReactFiberContext';
23
-import {Sync} from './ReactFiberExpirationTime';
24
-import {
25
- ClassComponent,
26
- FunctionComponent,
27
- ForwardRef,
28
- HostComponent,
29
- HostPortal,
30
- HostRoot,
31
- MemoComponent,
32
- SimpleMemoComponent,
33
-} from './ReactWorkTags';
22
+ setRefreshHandler as setRefreshHandler_old,
23
+ resolveFunctionForHotReloading as resolveFunctionForHotReloading_old,
24
+ resolveClassForHotReloading as resolveClassForHotReloading_old,
25
+ resolveForwardRefForHotReloading as resolveForwardRefForHotReloading_old,
26
+ isCompatibleFamilyForHotReloading as isCompatibleFamilyForHotReloading_old,
27
+ markFailedErrorBoundaryForHotReloading as markFailedErrorBoundaryForHotReloading_old,
28
+ scheduleRefresh as scheduleRefresh_old,
29
+ scheduleRoot as scheduleRoot_old,
30
+ findHostInstancesForRefresh as findHostInstancesForRefresh_old,
31
+} from './ReactFiberHotReloading.old';
32
+
33
+// TODO: Update these to point to the fork.
34
import {
35
- REACT_FORWARD_REF_TYPE,
36
- REACT_MEMO_TYPE,
37
- REACT_LAZY_TYPE,
38
-} from 'shared/ReactSymbols';
39
-
40
-export type Family = {|
41
- current: any,
42
-|};
43
-
44
-export type RefreshUpdate = {|
45
- staleFamilies: Set<Family>,
46
- updatedFamilies: Set<Family>,
47
-|};
48
-
49
-// Resolves type to a family.
50
-type RefreshHandler = any => Family | void;
51
-
52
-// Used by React Refresh runtime through DevTools Global Hook.
53
-export type SetRefreshHandler = (handler: RefreshHandler | null) => void;
54
-export type ScheduleRefresh = (root: FiberRoot, update: RefreshUpdate) => void;
55
-export type ScheduleRoot = (root: FiberRoot, element: ReactNodeList) => void;
56
-export type FindHostInstancesForRefresh = (
57
- root: FiberRoot,
58
- families: Array<Family>,
59
-) => Set<Instance>;
60
-
61
-let resolveFamily: RefreshHandler | null = null;
62
-// $FlowFixMe Flow gets confused by a WeakSet feature check below.
63
-let failedBoundaries: WeakSet<Fiber> | null = null;
64
-
65
-export const setRefreshHandler = (handler: RefreshHandler | null): void => {
66
- if (__DEV__) {
67
- resolveFamily = handler;
68
- }
69
-};
70
-
71
-export function resolveFunctionForHotReloading(type: any): any {
72
- if (__DEV__) {
73
- if (resolveFamily === null) {
74
- // Hot reloading is disabled.
75
- return type;
76
- }
77
- const family = resolveFamily(type);
78
- if (family === undefined) {
79
- return type;
80
- }
81
- // Use the latest known implementation.
82
- return family.current;
83
- } else {
84
- return type;
85
- }
86
-}
87
-
88
-export function resolveClassForHotReloading(type: any): any {
89
- // No implementation differences.
90
- return resolveFunctionForHotReloading(type);
91
-}
92
-
93
-export function resolveForwardRefForHotReloading(type: any): any {
94
- if (__DEV__) {
95
- if (resolveFamily === null) {
96
- // Hot reloading is disabled.
97
- return type;
98
- }
99
- const family = resolveFamily(type);
100
- if (family === undefined) {
101
- // Check if we're dealing with a real forwardRef. Don't want to crash early.
102
- if (
103
- type !== null &&
104
- type !== undefined &&
105
- typeof type.render === 'function'
106
- ) {
107
- // ForwardRef is special because its resolved .type is an object,
108
- // but it's possible that we only have its inner render function in the map.
109
- // If that inner render function is different, we'll build a new forwardRef type.
110
- const currentRender = resolveFunctionForHotReloading(type.render);
111
- if (type.render !== currentRender) {
112
- const syntheticType = {
113
- $$typeof: REACT_FORWARD_REF_TYPE,
114
- render: currentRender,
115
- };
116
- if (type.displayName !== undefined) {
117
- (syntheticType: any).displayName = type.displayName;
118
- }
119
- return syntheticType;
120
- }
121
- }
122
- return type;
123
- }
124
- // Use the latest known implementation.
125
- return family.current;
126
- } else {
127
- return type;
128
- }
129
-}
130
-
131
-export function isCompatibleFamilyForHotReloading(
132
- fiber: Fiber,
133
- element: ReactElement,
134
-): boolean {
135
- if (__DEV__) {
136
- if (resolveFamily === null) {
137
- // Hot reloading is disabled.
138
- return false;
139
- }
140
-
141
- const prevType = fiber.elementType;
142
- const nextType = element.type;
143
-
144
- // If we got here, we know types aren't === equal.
145
- let needsCompareFamilies = false;
146
-
147
- const $$typeofNextType =
148
- typeof nextType === 'object' && nextType !== null
149
- ? nextType.$$typeof
150
- : null;
151
-
152
- switch (fiber.tag) {
153
- case ClassComponent: {
154
- if (typeof nextType === 'function') {
155
- needsCompareFamilies = true;
156
- }
157
- break;
158
- }
159
- case FunctionComponent: {
160
- if (typeof nextType === 'function') {
161
- needsCompareFamilies = true;
162
- } else if ($$typeofNextType === REACT_LAZY_TYPE) {
163
- // We don't know the inner type yet.
164
- // We're going to assume that the lazy inner type is stable,
165
- // and so it is sufficient to avoid reconciling it away.
166
- // We're not going to unwrap or actually use the new lazy type.
167
- needsCompareFamilies = true;
168
- }
169
- break;
170
- }
171
- case ForwardRef: {
172
- if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
173
- needsCompareFamilies = true;
174
- } else if ($$typeofNextType === REACT_LAZY_TYPE) {
175
- needsCompareFamilies = true;
176
- }
177
- break;
178
- }
179
- case MemoComponent:
180
- case SimpleMemoComponent: {
181
- if ($$typeofNextType === REACT_MEMO_TYPE) {
182
- // TODO: if it was but can no longer be simple,
183
- // we shouldn't set this.
184
- needsCompareFamilies = true;
185
- } else if ($$typeofNextType === REACT_LAZY_TYPE) {
186
- needsCompareFamilies = true;
187
- }
188
- break;
189
- }
190
- default:
191
- return false;
192
- }
193
-
194
- // Check if both types have a family and it's the same one.
195
- if (needsCompareFamilies) {
196
- // Note: memo() and forwardRef() we'll compare outer rather than inner type.
197
- // This means both of them need to be registered to preserve state.
198
- // If we unwrapped and compared the inner types for wrappers instead,
199
- // then we would risk falsely saying two separate memo(Foo)
200
- // calls are equivalent because they wrap the same Foo function.
201
- const prevFamily = resolveFamily(prevType);
202
- if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
203
- return true;
204
- }
205
- }
206
- return false;
207
- } else {
208
- return false;
209
- }
210
-}
211
-
212
-export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
213
- if (__DEV__) {
214
- if (resolveFamily === null) {
215
- // Hot reloading is disabled.
216
- return;
217
- }
218
- if (typeof WeakSet !== 'function') {
219
- return;
220
- }
221
- if (failedBoundaries === null) {
222
- failedBoundaries = new WeakSet();
223
- }
224
- failedBoundaries.add(fiber);
225
- }
226
-}
227
-
228
-export const scheduleRefresh: ScheduleRefresh = (
229
- root: FiberRoot,
230
- update: RefreshUpdate,
231
-): void => {
232
- if (__DEV__) {
233
- if (resolveFamily === null) {
234
- // Hot reloading is disabled.
235
- return;
236
- }
237
- const {staleFamilies, updatedFamilies} = update;
238
- flushPassiveEffects();
239
- flushSync(() => {
240
- scheduleFibersWithFamiliesRecursively(
241
- root.current,
242
- updatedFamilies,
243
- staleFamilies,
244
- );
245
- });
246
- }
247
-};
248
-
249
-export const scheduleRoot: ScheduleRoot = (
250
- root: FiberRoot,
251
- element: ReactNodeList,
252
-): void => {
253
- if (__DEV__) {
254
- if (root.context !== emptyContextObject) {
255
- // Super edge case: root has a legacy _renderSubtree context
256
- // but we don't know the parentComponent so we can't pass it.
257
- // Just ignore. We'll delete this with _renderSubtree code path later.
258
- return;
259
- }
260
- flushPassiveEffects();
261
- syncUpdates(() => {
262
- updateContainer(element, root, null, null);
263
- });
264
- }
265
-};
266
-
267
-function scheduleFibersWithFamiliesRecursively(
268
- fiber: Fiber,
269
- updatedFamilies: Set<Family>,
270
- staleFamilies: Set<Family>,
271
-) {
272
- if (__DEV__) {
273
- const {alternate, child, sibling, tag, type} = fiber;
274
-
275
- let candidateType = null;
276
- switch (tag) {
277
- case FunctionComponent:
278
- case SimpleMemoComponent:
279
- case ClassComponent:
280
- candidateType = type;
281
- break;
282
- case ForwardRef:
283
- candidateType = type.render;
284
- break;
285
- default:
286
- break;
287
- }
288
-
289
- if (resolveFamily === null) {
290
- throw new Error('Expected resolveFamily to be set during hot reload.');
291
- }
292
-
293
- let needsRender = false;
294
- let needsRemount = false;
295
- if (candidateType !== null) {
296
- const family = resolveFamily(candidateType);
297
- if (family !== undefined) {
298
- if (staleFamilies.has(family)) {
299
- needsRemount = true;
300
- } else if (updatedFamilies.has(family)) {
301
- if (tag === ClassComponent) {
302
- needsRemount = true;
303
- } else {
304
- needsRender = true;
305
- }
306
- }
307
- }
308
- }
309
- if (failedBoundaries !== null) {
310
- if (
311
- failedBoundaries.has(fiber) ||
312
- (alternate !== null && failedBoundaries.has(alternate))
313
- ) {
314
- needsRemount = true;
315
- }
316
- }
317
-
318
- if (needsRemount) {
319
- fiber._debugNeedsRemount = true;
320
- }
321
- if (needsRemount || needsRender) {
322
- scheduleUpdateOnFiber(fiber, Sync);
323
- }
324
- if (child !== null && !needsRemount) {
325
- scheduleFibersWithFamiliesRecursively(
326
- child,
327
- updatedFamilies,
328
- staleFamilies,
329
- );
330
- }
331
- if (sibling !== null) {
332
- scheduleFibersWithFamiliesRecursively(
333
- sibling,
334
- updatedFamilies,
335
- staleFamilies,
336
- );
337
- }
338
- }
339
-}
340
-
341
-export const findHostInstancesForRefresh: FindHostInstancesForRefresh = (
342
- root: FiberRoot,
343
- families: Array<Family>,
344
-): Set<Instance> => {
345
- if (__DEV__) {
346
- const hostInstances = new Set();
347
- const types = new Set(families.map(family => family.current));
348
- findHostInstancesForMatchingFibersRecursively(
349
- root.current,
350
- types,
351
- hostInstances,
352
- );
353
- return hostInstances;
354
- } else {
355
- throw new Error(
356
- 'Did not expect findHostInstancesForRefresh to be called in production.',
357
- );
358
- }
359
-};
360
-
361
-function findHostInstancesForMatchingFibersRecursively(
362
- fiber: Fiber,
363
- types: Set<any>,
364
- hostInstances: Set<Instance>,
365
-) {
366
- if (__DEV__) {
367
- const {child, sibling, tag, type} = fiber;
368
-
369
- let candidateType = null;
370
- switch (tag) {
371
- case FunctionComponent:
372
- case SimpleMemoComponent:
373
- case ClassComponent:
374
- candidateType = type;
375
- break;
376
- case ForwardRef:
377
- candidateType = type.render;
378
- break;
379
- default:
380
- break;
381
- }
382
-
383
- let didMatch = false;
384
- if (candidateType !== null) {
385
- if (types.has(candidateType)) {
386
- didMatch = true;
387
- }
388
- }
389
-
390
- if (didMatch) {
391
- // We have a match. This only drills down to the closest host components.
392
- // There's no need to search deeper because for the purpose of giving
393
- // visual feedback, "flashing" outermost parent rectangles is sufficient.
394
- findHostInstancesForFiberShallowly(fiber, hostInstances);
395
- } else {
396
- // If there's no match, maybe there will be one further down in the child tree.
397
- if (child !== null) {
398
- findHostInstancesForMatchingFibersRecursively(
399
- child,
400
- types,
401
- hostInstances,
402
- );
403
- }
404
- }
405
-
406
- if (sibling !== null) {
407
- findHostInstancesForMatchingFibersRecursively(
408
- sibling,
409
- types,
410
- hostInstances,
411
- );
412
- }
413
- }
414
-}
415
-
416
-function findHostInstancesForFiberShallowly(
417
- fiber: Fiber,
418
- hostInstances: Set<Instance>,
419
-): void {
420
- if (__DEV__) {
421
- const foundHostInstances = findChildHostInstancesForFiberShallowly(
422
- fiber,
423
- hostInstances,
424
- );
425
- if (foundHostInstances) {
426
- return;
427
- }
428
- // If we didn't find any host children, fallback to closest host parent.
429
- let node = fiber;
430
- while (true) {
431
- switch (node.tag) {
432
- case HostComponent:
433
- hostInstances.add(node.stateNode);
434
- return;
435
- case HostPortal:
436
- hostInstances.add(node.stateNode.containerInfo);
437
- return;
438
- case HostRoot:
439
- hostInstances.add(node.stateNode.containerInfo);
440
- return;
441
- }
442
- if (node.return === null) {
443
- throw new Error('Expected to reach root first.');
444
- }
445
- node = node.return;
446
- }
447
- }
448
-}
449
-
450
-function findChildHostInstancesForFiberShallowly(
451
- fiber: Fiber,
452
- hostInstances: Set<Instance>,
453
-): boolean {
454
- if (__DEV__) {
455
- let node: Fiber = fiber;
456
- let foundHostInstances = false;
457
- while (true) {
458
- if (node.tag === HostComponent) {
459
- // We got a match.
460
- foundHostInstances = true;
461
- hostInstances.add(node.stateNode);
462
- // There may still be more, so keep searching.
463
- } else if (node.child !== null) {
464
- node.child.return = node;
465
- node = node.child;
466
- continue;
467
- }
468
- if (node === fiber) {
469
- return foundHostInstances;
470
- }
471
- while (node.sibling === null) {
472
- if (node.return === null || node.return === fiber) {
473
- return foundHostInstances;
474
- }
475
- node = node.return;
476
- }
477
- node.sibling.return = node.return;
478
- node = node.sibling;
479
- }
480
- }
481
- return false;
482
-}
35
+ setRefreshHandler as setRefreshHandler_new,
36
+ resolveFunctionForHotReloading as resolveFunctionForHotReloading_new,
37
+ resolveClassForHotReloading as resolveClassForHotReloading_new,
38
+ resolveForwardRefForHotReloading as resolveForwardRefForHotReloading_new,
39
+ isCompatibleFamilyForHotReloading as isCompatibleFamilyForHotReloading_new,
40
+ markFailedErrorBoundaryForHotReloading as markFailedErrorBoundaryForHotReloading_new,
41
+ scheduleRefresh as scheduleRefresh_new,
42
+ scheduleRoot as scheduleRoot_new,
43
+ findHostInstancesForRefresh as findHostInstancesForRefresh_new,
44
+} from './ReactFiberHotReloading.old';
45
+
46
+export const setRefreshHandler = enableNewReconciler
47
+ ? setRefreshHandler_new
48
+ : setRefreshHandler_old;
49
+export const resolveFunctionForHotReloading = enableNewReconciler
50
+ ? resolveFunctionForHotReloading_new
51
+ : resolveFunctionForHotReloading_old;
52
+export const resolveClassForHotReloading = enableNewReconciler
53
+ ? resolveClassForHotReloading_new
54
+ : resolveClassForHotReloading_old;
55
+export const resolveForwardRefForHotReloading = enableNewReconciler
56
+ ? resolveForwardRefForHotReloading_new
57
+ : resolveForwardRefForHotReloading_old;
58
+export const isCompatibleFamilyForHotReloading = enableNewReconciler
59
+ ? isCompatibleFamilyForHotReloading_new
60
+ : isCompatibleFamilyForHotReloading_old;
61
+export const markFailedErrorBoundaryForHotReloading = enableNewReconciler
62
+ ? markFailedErrorBoundaryForHotReloading_new
63
+ : markFailedErrorBoundaryForHotReloading_old;
64
+export const scheduleRefresh = enableNewReconciler
65
+ ? scheduleRefresh_new
66
+ : scheduleRefresh_old;
67
+export const scheduleRoot = enableNewReconciler
68
+ ? scheduleRoot_new
69
+ : scheduleRoot_old;
70
+export const findHostInstancesForRefresh = enableNewReconciler
71
+ ? findHostInstancesForRefresh_new
72
+ : findHostInstancesForRefresh_old;
packages/react-reconciler/src/ReactFiberHotReloading.old.js
new
+482
@@ -0,0 +1,482 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ */
9
+
10
+import type {ReactElement} from 'shared/ReactElementType';
11
+import type {Fiber} from './ReactFiber.old';
12
+import type {FiberRoot} from './ReactFiberRoot.old';
13
+import type {Instance} from './ReactFiberHostConfig';
14
+import type {ReactNodeList} from 'shared/ReactTypes';
15
+
16
+import {
17
+ flushSync,
18
+ scheduleUpdateOnFiber,
19
+ flushPassiveEffects,
20
+} from './ReactFiberWorkLoop.old';
21
+import {updateContainer, syncUpdates} from './ReactFiberReconciler.old';
22
+import {emptyContextObject} from './ReactFiberContext.old';
23
+import {Sync} from './ReactFiberExpirationTime.old';
24
+import {
25
+ ClassComponent,
26
+ FunctionComponent,
27
+ ForwardRef,
28
+ HostComponent,
29
+ HostPortal,
30
+ HostRoot,
31
+ MemoComponent,
32
+ SimpleMemoComponent,
33
+} from './ReactWorkTags';
34
+import {
35
+ REACT_FORWARD_REF_TYPE,
36
+ REACT_MEMO_TYPE,
37
+ REACT_LAZY_TYPE,
38
+} from 'shared/ReactSymbols';
39
+
40
+export type Family = {|
41
+ current: any,
42
+|};
43
+
44
+export type RefreshUpdate = {|
45
+ staleFamilies: Set<Family>,
46
+ updatedFamilies: Set<Family>,
47
+|};
48
+
49
+// Resolves type to a family.
50
+type RefreshHandler = any => Family | void;
51
+
52
+// Used by React Refresh runtime through DevTools Global Hook.
53
+export type SetRefreshHandler = (handler: RefreshHandler | null) => void;
54
+export type ScheduleRefresh = (root: FiberRoot, update: RefreshUpdate) => void;
55
+export type ScheduleRoot = (root: FiberRoot, element: ReactNodeList) => void;
56
+export type FindHostInstancesForRefresh = (
57
+ root: FiberRoot,
58
+ families: Array<Family>,
59
+) => Set<Instance>;
60
+
61
+let resolveFamily: RefreshHandler | null = null;
62
+// $FlowFixMe Flow gets confused by a WeakSet feature check below.
63
+let failedBoundaries: WeakSet<Fiber> | null = null;
64
+
65
+export const setRefreshHandler = (handler: RefreshHandler | null): void => {
66
+ if (__DEV__) {
67
+ resolveFamily = handler;
68
+ }
69
+};
70
+
71
+export function resolveFunctionForHotReloading(type: any): any {
72
+ if (__DEV__) {
73
+ if (resolveFamily === null) {
74
+ // Hot reloading is disabled.
75
+ return type;
76
+ }
77
+ const family = resolveFamily(type);
78
+ if (family === undefined) {
79
+ return type;
80
+ }
81
+ // Use the latest known implementation.
82
+ return family.current;
83
+ } else {
84
+ return type;
85
+ }
86
+}
87
+
88
+export function resolveClassForHotReloading(type: any): any {
89
+ // No implementation differences.
90
+ return resolveFunctionForHotReloading(type);
91
+}
92
+
93
+export function resolveForwardRefForHotReloading(type: any): any {
94
+ if (__DEV__) {
95
+ if (resolveFamily === null) {
96
+ // Hot reloading is disabled.
97
+ return type;
98
+ }
99
+ const family = resolveFamily(type);
100
+ if (family === undefined) {
101
+ // Check if we're dealing with a real forwardRef. Don't want to crash early.
102
+ if (
103
+ type !== null &&
104
+ type !== undefined &&
105
+ typeof type.render === 'function'
106
+ ) {
107
+ // ForwardRef is special because its resolved .type is an object,
108
+ // but it's possible that we only have its inner render function in the map.
109
+ // If that inner render function is different, we'll build a new forwardRef type.
110
+ const currentRender = resolveFunctionForHotReloading(type.render);
111
+ if (type.render !== currentRender) {
112
+ const syntheticType = {
113
+ $$typeof: REACT_FORWARD_REF_TYPE,
114
+ render: currentRender,
115
+ };
116
+ if (type.displayName !== undefined) {
117
+ (syntheticType: any).displayName = type.displayName;
118
+ }
119
+ return syntheticType;
120
+ }
121
+ }
122
+ return type;
123
+ }
124
+ // Use the latest known implementation.
125
+ return family.current;
126
+ } else {
127
+ return type;
128
+ }
129
+}
130
+
131
+export function isCompatibleFamilyForHotReloading(
132
+ fiber: Fiber,
133
+ element: ReactElement,
134
+): boolean {
135
+ if (__DEV__) {
136
+ if (resolveFamily === null) {
137
+ // Hot reloading is disabled.
138
+ return false;
139
+ }
140
+
141
+ const prevType = fiber.elementType;
142
+ const nextType = element.type;
143
+
144
+ // If we got here, we know types aren't === equal.
145
+ let needsCompareFamilies = false;
146
+
147
+ const $$typeofNextType =
148
+ typeof nextType === 'object' && nextType !== null
149
+ ? nextType.$$typeof
150
+ : null;
151
+
152
+ switch (fiber.tag) {
153
+ case ClassComponent: {
154
+ if (typeof nextType === 'function') {
155
+ needsCompareFamilies = true;
156
+ }
157
+ break;
158
+ }
159
+ case FunctionComponent: {
160
+ if (typeof nextType === 'function') {
161
+ needsCompareFamilies = true;
162
+ } else if ($$typeofNextType === REACT_LAZY_TYPE) {
163
+ // We don't know the inner type yet.
164
+ // We're going to assume that the lazy inner type is stable,
165
+ // and so it is sufficient to avoid reconciling it away.
166
+ // We're not going to unwrap or actually use the new lazy type.
167
+ needsCompareFamilies = true;
168
+ }
169
+ break;
170
+ }
171
+ case ForwardRef: {
172
+ if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
173
+ needsCompareFamilies = true;
174
+ } else if ($$typeofNextType === REACT_LAZY_TYPE) {
175
+ needsCompareFamilies = true;
176
+ }
177
+ break;
178
+ }
179
+ case MemoComponent:
180
+ case SimpleMemoComponent: {
181
+ if ($$typeofNextType === REACT_MEMO_TYPE) {
182
+ // TODO: if it was but can no longer be simple,
183
+ // we shouldn't set this.
184
+ needsCompareFamilies = true;
185
+ } else if ($$typeofNextType === REACT_LAZY_TYPE) {
186
+ needsCompareFamilies = true;
187
+ }
188
+ break;
189
+ }
190
+ default:
191
+ return false;
192
+ }
193
+
194
+ // Check if both types have a family and it's the same one.
195
+ if (needsCompareFamilies) {
196
+ // Note: memo() and forwardRef() we'll compare outer rather than inner type.
197
+ // This means both of them need to be registered to preserve state.
198
+ // If we unwrapped and compared the inner types for wrappers instead,
199
+ // then we would risk falsely saying two separate memo(Foo)
200
+ // calls are equivalent because they wrap the same Foo function.
201
+ const prevFamily = resolveFamily(prevType);
202
+ if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
203
+ return true;
204
+ }
205
+ }
206
+ return false;
207
+ } else {
208
+ return false;
209
+ }
210
+}
211
+
212
+export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
213
+ if (__DEV__) {
214
+ if (resolveFamily === null) {
215
+ // Hot reloading is disabled.
216
+ return;
217
+ }
218
+ if (typeof WeakSet !== 'function') {
219
+ return;
220
+ }
221
+ if (failedBoundaries === null) {
222
+ failedBoundaries = new WeakSet();
223
+ }
224
+ failedBoundaries.add(fiber);
225
+ }
226
+}
227
+
228
+export const scheduleRefresh: ScheduleRefresh = (
229
+ root: FiberRoot,
230
+ update: RefreshUpdate,
231
+): void => {
232
+ if (__DEV__) {
233
+ if (resolveFamily === null) {
234
+ // Hot reloading is disabled.
235
+ return;
236
+ }
237
+ const {staleFamilies, updatedFamilies} = update;
238
+ flushPassiveEffects();
239
+ flushSync(() => {
240
+ scheduleFibersWithFamiliesRecursively(
241
+ root.current,
242
+ updatedFamilies,
243
+ staleFamilies,
244
+ );
245
+ });
246
+ }
247
+};
248
+
249
+export const scheduleRoot: ScheduleRoot = (
250
+ root: FiberRoot,
251
+ element: ReactNodeList,
252
+): void => {
253
+ if (__DEV__) {
254
+ if (root.context !== emptyContextObject) {
255
+ // Super edge case: root has a legacy _renderSubtree context
256
+ // but we don't know the parentComponent so we can't pass it.
257
+ // Just ignore. We'll delete this with _renderSubtree code path later.
258
+ return;
259
+ }
260
+ flushPassiveEffects();
261
+ syncUpdates(() => {
262
+ updateContainer(element, root, null, null);
263
+ });
264
+ }
265
+};
266
+
267
+function scheduleFibersWithFamiliesRecursively(
268
+ fiber: Fiber,
269
+ updatedFamilies: Set<Family>,
270
+ staleFamilies: Set<Family>,
271
+) {
272
+ if (__DEV__) {
273
+ const {alternate, child, sibling, tag, type} = fiber;
274
+
275
+ let candidateType = null;
276
+ switch (tag) {
277
+ case FunctionComponent:
278
+ case SimpleMemoComponent:
279
+ case ClassComponent:
280
+ candidateType = type;
281
+ break;
282
+ case ForwardRef:
283
+ candidateType = type.render;
284
+ break;
285
+ default:
286
+ break;
287
+ }
288
+
289
+ if (resolveFamily === null) {
290
+ throw new Error('Expected resolveFamily to be set during hot reload.');
291
+ }
292
+
293
+ let needsRender = false;
294
+ let needsRemount = false;
295
+ if (candidateType !== null) {
296
+ const family = resolveFamily(candidateType);
297
+ if (family !== undefined) {
298
+ if (staleFamilies.has(family)) {
299
+ needsRemount = true;
300
+ } else if (updatedFamilies.has(family)) {
301
+ if (tag === ClassComponent) {
302
+ needsRemount = true;
303
+ } else {
304
+ needsRender = true;
305
+ }
306
+ }
307
+ }
308
+ }
309
+ if (failedBoundaries !== null) {
310
+ if (
311
+ failedBoundaries.has(fiber) ||
312
+ (alternate !== null && failedBoundaries.has(alternate))
313
+ ) {
314
+ needsRemount = true;
315
+ }
316
+ }
317
+
318
+ if (needsRemount) {
319
+ fiber._debugNeedsRemount = true;
320
+ }
321
+ if (needsRemount || needsRender) {
322
+ scheduleUpdateOnFiber(fiber, Sync);
323
+ }
324
+ if (child !== null && !needsRemount) {
325
+ scheduleFibersWithFamiliesRecursively(
326
+ child,
327
+ updatedFamilies,
328
+ staleFamilies,
329
+ );
330
+ }
331
+ if (sibling !== null) {
332
+ scheduleFibersWithFamiliesRecursively(
333
+ sibling,
334
+ updatedFamilies,
335
+ staleFamilies,
336
+ );
337
+ }
338
+ }
339
+}
340
+
341
+export const findHostInstancesForRefresh: FindHostInstancesForRefresh = (
342
+ root: FiberRoot,
343
+ families: Array<Family>,
344
+): Set<Instance> => {
345
+ if (__DEV__) {
346
+ const hostInstances = new Set();
347
+ const types = new Set(families.map(family => family.current));
348
+ findHostInstancesForMatchingFibersRecursively(
349
+ root.current,
350
+ types,
351
+ hostInstances,
352
+ );
353
+ return hostInstances;
354
+ } else {
355
+ throw new Error(
356
+ 'Did not expect findHostInstancesForRefresh to be called in production.',
357
+ );
358
+ }
359
+};
360
+
361
+function findHostInstancesForMatchingFibersRecursively(
362
+ fiber: Fiber,
363
+ types: Set<any>,
364
+ hostInstances: Set<Instance>,
365
+) {
366
+ if (__DEV__) {
367
+ const {child, sibling, tag, type} = fiber;
368
+
369
+ let candidateType = null;
370
+ switch (tag) {
371
+ case FunctionComponent:
372
+ case SimpleMemoComponent:
373
+ case ClassComponent:
374
+ candidateType = type;
375
+ break;
376
+ case ForwardRef:
377
+ candidateType = type.render;
378
+ break;
379
+ default:
380
+ break;
381
+ }
382
+
383
+ let didMatch = false;
384
+ if (candidateType !== null) {
385
+ if (types.has(candidateType)) {
386
+ didMatch = true;
387
+ }
388
+ }
389
+
390
+ if (didMatch) {
391
+ // We have a match. This only drills down to the closest host components.
392
+ // There's no need to search deeper because for the purpose of giving
393
+ // visual feedback, "flashing" outermost parent rectangles is sufficient.
394
+ findHostInstancesForFiberShallowly(fiber, hostInstances);
395
+ } else {
396
+ // If there's no match, maybe there will be one further down in the child tree.
397
+ if (child !== null) {
398
+ findHostInstancesForMatchingFibersRecursively(
399
+ child,
400
+ types,
401
+ hostInstances,
402
+ );
403
+ }
404
+ }
405
+
406
+ if (sibling !== null) {
407
+ findHostInstancesForMatchingFibersRecursively(
408
+ sibling,
409
+ types,
410
+ hostInstances,
411
+ );
412
+ }
413
+ }
414
+}
415
+
416
+function findHostInstancesForFiberShallowly(
417
+ fiber: Fiber,
418
+ hostInstances: Set<Instance>,
419
+): void {
420
+ if (__DEV__) {
421
+ const foundHostInstances = findChildHostInstancesForFiberShallowly(
422
+ fiber,
423
+ hostInstances,
424
+ );
425
+ if (foundHostInstances) {
426
+ return;
427
+ }
428
+ // If we didn't find any host children, fallback to closest host parent.
429
+ let node = fiber;
430
+ while (true) {
431
+ switch (node.tag) {
432
+ case HostComponent:
433
+ hostInstances.add(node.stateNode);
434
+ return;
435
+ case HostPortal:
436
+ hostInstances.add(node.stateNode.containerInfo);
437
+ return;
438
+ case HostRoot:
439
+ hostInstances.add(node.stateNode.containerInfo);
440
+ return;
441
+ }
442
+ if (node.return === null) {
443
+ throw new Error('Expected to reach root first.');
444
+ }
445
+ node = node.return;
446
+ }
447
+ }
448
+}
449
+
450
+function findChildHostInstancesForFiberShallowly(
451
+ fiber: Fiber,
452
+ hostInstances: Set<Instance>,
453
+): boolean {
454
+ if (__DEV__) {
455
+ let node: Fiber = fiber;
456
+ let foundHostInstances = false;
457
+ while (true) {
458
+ if (node.tag === HostComponent) {
459
+ // We got a match.
460
+ foundHostInstances = true;
461
+ hostInstances.add(node.stateNode);
462
+ // There may still be more, so keep searching.
463
+ } else if (node.child !== null) {
464
+ node.child.return = node;
465
+ node = node.child;
466
+ continue;
467
+ }
468
+ if (node === fiber) {
469
+ return foundHostInstances;
470
+ }
471
+ while (node.sibling === null) {
472
+ if (node.return === null || node.return === fiber) {
473
+ return foundHostInstances;
474
+ }
475
+ node = node.return;
476
+ }
477
+ node.sibling.return = node.return;
478
+ node = node.sibling;
479
+ }
480
+ }
481
+ return false;
482
+}
packages/react-reconciler/src/ReactFiberHydrationContext.old.js
renamed
+4
-4
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {
12
Instance,
13
TextInstance,
@@ -16,7 +16,7 @@ import type {
16
Container,
17
HostContext,
18
} from './ReactFiberHostConfig';
19
-import type {SuspenseState} from './ReactFiberSuspenseComponent';
19
+import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
20
21
import {
22
HostComponent,
@@ -30,7 +30,7 @@ import invariant from 'shared/invariant';
30
import {
31
createFiberFromHostInstanceForDeletion,
32
createFiberFromDehydratedFragment,
33
-} from './ReactFiber';
33
+} from './ReactFiber.old';
34
import {
35
shouldSetTextContent,
36
supportsHydration,
@@ -55,7 +55,7 @@ import {
55
didNotFindHydratableSuspenseInstance,
56
} from './ReactFiberHostConfig';
57
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
58
-import {Never, NoWork} from './ReactFiberExpirationTime';
58
+import {Never, NoWork} from './ReactFiberExpirationTime.old';
59
60
// The deepest Fiber on the stack involved in a hydration context.
61
// This may have been an insertion or a hydration.
packages/react-reconciler/src/ReactFiberLazyComponent.old.js
renamed
packages/react-reconciler/src/ReactFiberNewContext.old.js
renamed
+7
-11
@@ -8,9 +8,9 @@
8
*/
9
10
import type {ReactContext} from 'shared/ReactTypes';
11
-import type {Fiber} from './ReactFiber';
12
-import type {StackCursor} from './ReactFiberStack';
13
-import type {ExpirationTime} from './ReactFiberExpirationTime';
11
+import type {Fiber} from './ReactFiber.old';
12
+import type {StackCursor} from './ReactFiberStack.old';
13
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
14
15
export type ContextDependency<T> = {
16
context: ReactContext<T>,
@@ -20,7 +20,7 @@ export type ContextDependency<T> = {
20
};
21
22
import {isPrimaryRenderer} from './ReactFiberHostConfig';
23
-import {createCursor, push, pop} from './ReactFiberStack';
23
+import {createCursor, push, pop} from './ReactFiberStack.old';
24
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
25
import {
26
ContextProvider,
@@ -30,13 +30,9 @@ import {
30
31
import invariant from 'shared/invariant';
32
import is from 'shared/objectIs';
33
-import {
34
- createUpdate,
35
- enqueueUpdate,
36
- ForceUpdate,
37
-} from 'react-reconciler/src/ReactUpdateQueue';
38
-import {NoWork} from './ReactFiberExpirationTime';
39
-import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork';
33
+import {createUpdate, enqueueUpdate, ForceUpdate} from './ReactUpdateQueue.old';
34
+import {NoWork} from './ReactFiberExpirationTime.old';
35
+import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
36
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
37
38
const valueCursor: StackCursor<mixed> = createCursor(null);
packages/react-reconciler/src/ReactFiberReconciler.old.js
+14
-14
@@ -7,9 +7,9 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {FiberRoot} from './ReactFiberRoot';
12
-import type {RootTag} from 'react-reconciler/src/ReactRootTags';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {FiberRoot} from './ReactFiberRoot.old';
12
+import type {RootTag} from './ReactRootTags';
13
import type {
14
Instance,
15
TextInstance,
@@ -19,16 +19,16 @@ import type {
19
import type {RendererInspectionConfig} from './ReactFiberHostConfig';
20
import {FundamentalComponent} from './ReactWorkTags';
21
import type {ReactNodeList, Thenable} from 'shared/ReactTypes';
22
-import type {ExpirationTime} from './ReactFiberExpirationTime';
22
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
23
import type {
24
SuspenseHydrationCallbacks,
25
SuspenseState,
26
-} from './ReactFiberSuspenseComponent';
26
+} from './ReactFiberSuspenseComponent.old';
27
28
import {
29
findCurrentHostFiber,
30
findCurrentHostFiberWithNoPortals,
31
-} from 'react-reconciler/src/ReactFiberTreeReflection';
31
+} from './ReactFiberTreeReflection';
32
import {get as getInstance} from 'shared/ReactInstanceMap';
33
import {
34
HostComponent,
@@ -46,9 +46,9 @@ import {
46
processChildContext,
47
emptyContextObject,
48
isContextProvider as isLegacyContextProvider,
49
-} from './ReactFiberContext';
50
-import {createFiberRoot} from './ReactFiberRoot';
51
-import {injectInternals, onScheduleRoot} from './ReactFiberDevToolsHook';
49
+} from './ReactFiberContext.old';
50
+import {createFiberRoot} from './ReactFiberRoot.old';
51
+import {injectInternals, onScheduleRoot} from './ReactFiberDevToolsHook.old';
52
import {
53
requestCurrentTimeForUpdate,
54
computeExpirationForFiber,
@@ -67,8 +67,8 @@ import {
67
warnIfNotScopedWithMatchingAct,
68
warnIfUnmockedScheduler,
69
IsThisRendererActing,
70
-} from './ReactFiberWorkLoop';
71
-import {createUpdate, enqueueUpdate} from './ReactUpdateQueue';
70
+} from './ReactFiberWorkLoop.old';
71
+import {createUpdate, enqueueUpdate} from './ReactUpdateQueue.old';
72
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
73
import {
74
isRendering as ReactCurrentFiberIsRendering,
@@ -79,14 +79,14 @@ import {
79
Sync,
80
ContinuousHydration,
81
computeInteractiveExpiration,
82
-} from './ReactFiberExpirationTime';
83
-import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
82
+} from './ReactFiberExpirationTime.old';
83
+import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
84
import {
85
scheduleRefresh,
86
scheduleRoot,
87
setRefreshHandler,
88
findHostInstancesForRefresh,
89
-} from './ReactFiberHotReloading';
89
+} from './ReactFiberHotReloading.old';
90
91
// used by isTestEnvironment builds
92
import enqueueTask from 'shared/enqueueTask';
packages/react-reconciler/src/ReactFiberRoot.old.js
renamed
+10
-10
@@ -7,26 +7,26 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {ExpirationTime} from './ReactFiberExpirationTime';
12
-import type {RootTag} from 'react-reconciler/src/ReactRootTags';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
12
+import type {RootTag} from './ReactRootTags';
13
import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
14
import type {Wakeable} from 'shared/ReactTypes';
15
import type {Interaction} from 'scheduler/src/Tracing';
16
-import type {SuspenseHydrationCallbacks} from './ReactFiberSuspenseComponent';
17
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
16
+import type {SuspenseHydrationCallbacks} from './ReactFiberSuspenseComponent.old';
17
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
18
19
import {noTimeout} from './ReactFiberHostConfig';
20
-import {createHostRootFiber} from './ReactFiber';
21
-import {NoWork} from './ReactFiberExpirationTime';
20
+import {createHostRootFiber} from './ReactFiber.old';
21
+import {NoWork} from './ReactFiberExpirationTime.old';
22
import {
23
enableSchedulerTracing,
24
enableSuspenseCallback,
25
} from 'shared/ReactFeatureFlags';
26
import {unstable_getThreadID} from 'scheduler/tracing';
27
-import {NoPriority} from './SchedulerWithReactIntegration';
28
-import {initializeUpdateQueue} from './ReactUpdateQueue';
29
-import {clearPendingUpdates as clearPendingMutableSourceUpdates} from './ReactMutableSource';
27
+import {NoPriority} from './SchedulerWithReactIntegration.old';
28
+import {initializeUpdateQueue} from './ReactUpdateQueue.old';
29
+import {clearPendingUpdates as clearPendingMutableSourceUpdates} from './ReactMutableSource.old';
30
31
export type PendingInteractionMap = Map<ExpirationTime, Set<Interaction>>;
32
packages/react-reconciler/src/ReactFiberScope.old.js
renamed
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {
12
ReactScope,
13
ReactScopeInstance,
packages/react-reconciler/src/ReactFiberStack.old.js
renamed
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
export type StackCursor<T> = {|current: T|};
13
packages/react-reconciler/src/ReactFiberSuspenseComponent.old.js
renamed
+2
-2
@@ -7,9 +7,9 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {SuspenseInstance} from './ReactFiberHostConfig';
12
-import type {ExpirationTime} from './ReactFiberExpirationTime';
12
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
13
import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
14
import {NoEffect, DidCapture} from './ReactSideEffectTags';
15
import {
packages/react-reconciler/src/ReactFiberSuspenseConfig.old.js
renamed
packages/react-reconciler/src/ReactFiberSuspenseContext.old.js
renamed
+3
-3
@@ -7,10 +7,10 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {StackCursor} from './ReactFiberStack';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {StackCursor} from './ReactFiberStack.old';
12
13
-import {createCursor, push, pop} from './ReactFiberStack';
13
+import {createCursor, push, pop} from './ReactFiberStack.old';
14
15
export opaque type SuspenseContext = number;
16
export opaque type SubtreeSuspenseContext: SuspenseContext = number;
packages/react-reconciler/src/ReactFiberThrow.old.js
renamed
+11
-11
@@ -7,13 +7,13 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {FiberRoot} from './ReactFiberRoot';
12
-import type {ExpirationTime} from './ReactFiberExpirationTime';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {FiberRoot} from './ReactFiberRoot.old';
12
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
13
import type {CapturedValue} from './ReactCapturedValue';
14
-import type {Update} from './ReactUpdateQueue';
14
+import type {Update} from './ReactUpdateQueue.old';
15
import type {Wakeable} from 'shared/ReactTypes';
16
-import type {SuspenseContext} from './ReactFiberSuspenseContext';
16
+import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
17
18
import getComponentName from 'shared/getComponentName';
19
import {
@@ -30,7 +30,7 @@ import {
30
LifecycleEffectMask,
31
} from './ReactSideEffectTags';
32
import {NoMode, BlockingMode} from './ReactTypeOfMode';
33
-import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent';
33
+import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.old';
34
35
import {createCapturedValue} from './ReactCapturedValue';
36
import {
@@ -39,24 +39,24 @@ import {
39
CaptureUpdate,
40
ForceUpdate,
41
enqueueUpdate,
42
-} from './ReactUpdateQueue';
42
+} from './ReactUpdateQueue.old';
43
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
44
-import {markFailedErrorBoundaryForHotReloading} from './ReactFiberHotReloading';
44
+import {markFailedErrorBoundaryForHotReloading} from './ReactFiberHotReloading.old';
45
import {
46
suspenseStackCursor,
47
InvisibleParentSuspenseContext,
48
hasSuspenseContext,
49
-} from './ReactFiberSuspenseContext';
49
+} from './ReactFiberSuspenseContext.old';
50
import {
51
renderDidError,
52
onUncaughtError,
53
markLegacyErrorBoundaryAsFailed,
54
isAlreadyFailedLegacyErrorBoundary,
55
pingSuspendedRoot,
56
-} from './ReactFiberWorkLoop';
56
+} from './ReactFiberWorkLoop.old';
57
import {logCapturedError} from './ReactFiberErrorLogger';
58
59
-import {Sync} from './ReactFiberExpirationTime';
59
+import {Sync} from './ReactFiberExpirationTime.old';
60
61
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
62
packages/react-reconciler/src/ReactFiberTreeReflection.js
+2
-2
@@ -7,9 +7,9 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
import type {Container, SuspenseInstance} from './ReactFiberHostConfig';
12
-import type {SuspenseState} from './ReactFiberSuspenseComponent';
12
+import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
13
14
import invariant from 'shared/invariant';
15
packages/react-reconciler/src/ReactFiberUnwindWork.old.js
renamed
+9
-9
@@ -7,11 +7,11 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
11
-import type {ExpirationTime} from './ReactFiberExpirationTime';
12
-import type {SuspenseState} from './ReactFiberSuspenseComponent';
10
+import type {Fiber} from './ReactFiber.old';
11
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
12
+import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
13
14
-import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource';
14
+import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
15
import {
16
ClassComponent,
17
HostRoot,
@@ -24,15 +24,15 @@ import {
24
import {DidCapture, NoEffect, ShouldCapture} from './ReactSideEffectTags';
25
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
26
27
-import {popHostContainer, popHostContext} from './ReactFiberHostContext';
28
-import {popSuspenseContext} from './ReactFiberSuspenseContext';
29
-import {resetHydrationState} from './ReactFiberHydrationContext';
27
+import {popHostContainer, popHostContext} from './ReactFiberHostContext.old';
28
+import {popSuspenseContext} from './ReactFiberSuspenseContext.old';
29
+import {resetHydrationState} from './ReactFiberHydrationContext.old';
30
import {
31
isContextProvider as isLegacyContextProvider,
32
popContext as popLegacyContext,
33
popTopLevelContextObject as popTopLevelLegacyContextObject,
34
-} from './ReactFiberContext';
35
-import {popProvider} from './ReactFiberNewContext';
34
+} from './ReactFiberContext.old';
35
+import {popProvider} from './ReactFiberNewContext.old';
36
37
import invariant from 'shared/invariant';
38
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
renamed
+26
-23
@@ -8,14 +8,14 @@
8
*/
9
10
import type {Wakeable} from 'shared/ReactTypes';
11
-import type {Fiber} from './ReactFiber';
12
-import type {FiberRoot} from './ReactFiberRoot';
13
-import type {ExpirationTime} from './ReactFiberExpirationTime';
14
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
11
+import type {Fiber} from './ReactFiber.old';
12
+import type {FiberRoot} from './ReactFiberRoot.old';
13
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
14
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
15
import type {Interaction} from 'scheduler/src/Tracing';
16
-import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
17
-import type {SuspenseState} from './ReactFiberSuspenseComponent';
18
-import type {Effect as HookEffect} from './ReactFiberHooks';
16
+import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
17
+import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
18
+import type {Effect as HookEffect} from './ReactFiberHooks.old';
19
20
import {
21
warnAboutDeprecatedLifecycles,
@@ -49,7 +49,7 @@ import {
49
IdlePriority,
50
flushSyncCallbackQueue,
51
scheduleSyncCallback,
52
-} from './SchedulerWithReactIntegration';
52
+} from './SchedulerWithReactIntegration.old';
53
54
// The scheduler is imported here *only* to detect whether it's been mocked
55
import * as Scheduler from 'scheduler';
@@ -65,14 +65,17 @@ import {
65
warnsIfNotActing,
66
} from './ReactFiberHostConfig';
67
68
-import {createWorkInProgress, assignFiberPropertiesInDEV} from './ReactFiber';
68
+import {
69
+ createWorkInProgress,
70
+ assignFiberPropertiesInDEV,
71
+} from './ReactFiber.old';
72
import {
73
isRootSuspendedAtTime,
74
markRootSuspendedAtTime,
75
markRootFinishedAtTime,
76
markRootUpdatedAtTime,
77
markRootExpiredAtTime,
75
-} from './ReactFiberRoot';
78
+} from './ReactFiberRoot.old';
79
import {
80
NoMode,
81
StrictMode,
@@ -91,7 +94,7 @@ import {
94
SimpleMemoComponent,
95
Block,
96
} from './ReactWorkTags';
94
-import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
97
+import {LegacyRoot} from './ReactRootTags';
98
import {
99
NoEffect,
100
PerformedWork,
@@ -122,15 +125,15 @@ import {
125
LOW_PRIORITY_EXPIRATION,
126
Batched,
127
Idle,
125
-} from './ReactFiberExpirationTime';
126
-import {beginWork as originalBeginWork} from './ReactFiberBeginWork';
127
-import {completeWork} from './ReactFiberCompleteWork';
128
-import {unwindWork, unwindInterruptedWork} from './ReactFiberUnwindWork';
128
+} from './ReactFiberExpirationTime.old';
129
+import {beginWork as originalBeginWork} from './ReactFiberBeginWork.old';
130
+import {completeWork} from './ReactFiberCompleteWork.old';
131
+import {unwindWork, unwindInterruptedWork} from './ReactFiberUnwindWork.old';
132
import {
133
throwException,
134
createRootErrorUpdate,
135
createClassErrorUpdate,
133
-} from './ReactFiberThrow';
136
+} from './ReactFiberThrow.old';
137
import {
138
commitBeforeMutationLifeCycles as commitBeforeMutationEffectOnFiber,
139
commitLifeCycles as commitLayoutEffectOnFiber,
@@ -142,14 +145,14 @@ import {
145
commitAttachRef,
146
commitPassiveEffectDurations,
147
commitResetTextContent,
145
-} from './ReactFiberCommitWork';
146
-import {enqueueUpdate} from './ReactUpdateQueue';
147
-import {resetContextDependencies} from './ReactFiberNewContext';
148
+} from './ReactFiberCommitWork.old';
149
+import {enqueueUpdate} from './ReactUpdateQueue.old';
150
+import {resetContextDependencies} from './ReactFiberNewContext.old';
151
import {
152
resetHooksAfterThrow,
153
ContextOnlyDispatcher,
154
getIsUpdatingOpaqueValueInRenderPhaseInDEV,
152
-} from './ReactFiberHooks';
155
+} from './ReactFiberHooks.old';
156
import {createCapturedValue} from './ReactCapturedValue';
157
158
import {
@@ -158,11 +161,11 @@ import {
161
startPassiveEffectTimer,
162
startProfilerTimer,
163
stopProfilerTimerIfRunningAndRecordDelta,
161
-} from './ReactProfilerTimer';
164
+} from './ReactProfilerTimer.old';
165
166
// DEV stuff
167
import getComponentName from 'shared/getComponentName';
165
-import ReactStrictModeWarnings from './ReactStrictModeWarnings';
168
+import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
169
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
170
import {
171
isRendering as ReactCurrentDebugFiberIsRenderingInDEV,
@@ -174,7 +177,7 @@ import {
177
hasCaughtError,
178
clearCaughtError,
179
} from 'shared/ReactErrorUtils';
177
-import {onCommitRoot} from './ReactFiberDevToolsHook';
180
+import {onCommitRoot} from './ReactFiberDevToolsHook.old';
181
182
const ceil = Math.ceil;
183
packages/react-reconciler/src/ReactMutableSource.old.js
renamed
+3
-3
@@ -7,12 +7,12 @@
7
* @flow
8
*/
9
10
-import type {ExpirationTime} from 'react-reconciler/src/ReactFiberExpirationTime';
11
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
10
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
11
+import type {FiberRoot} from './ReactFiberRoot.old';
12
import type {MutableSource, MutableSourceVersion} from 'shared/ReactTypes';
13
14
import {isPrimaryRenderer} from './ReactFiberHostConfig';
15
-import {NoWork} from './ReactFiberExpirationTime';
15
+import {NoWork} from './ReactFiberExpirationTime.old';
16
17
// Work in progress version numbers only apply to a single render,
18
// and should be reset before starting a new render.
packages/react-reconciler/src/ReactProfilerTimer.old.js
renamed
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
import {
13
enableProfilerTimer,
packages/react-reconciler/src/ReactStrictModeWarnings.old.js
renamed
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from './ReactFiber';
10
+import type {Fiber} from './ReactFiber.old';
11
12
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
13
packages/react-reconciler/src/ReactUpdateQueue.old.js
renamed
+8
-8
@@ -84,16 +84,16 @@
84
// regardless of priority. Intermediate state may vary according to system
85
// resources, but the final state is always the same.
86
87
-import type {Fiber} from './ReactFiber';
88
-import type {ExpirationTime} from './ReactFiberExpirationTime';
89
-import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
90
-import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
87
+import type {Fiber} from './ReactFiber.old';
88
+import type {ExpirationTime} from './ReactFiberExpirationTime.old';
89
+import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
90
+import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
91
92
-import {NoWork, Sync} from './ReactFiberExpirationTime';
92
+import {NoWork, Sync} from './ReactFiberExpirationTime.old';
93
import {
94
enterDisallowedContextReadInDEV,
95
exitDisallowedContextReadInDEV,
96
-} from './ReactFiberNewContext';
96
+} from './ReactFiberNewContext.old';
97
import {Callback, ShouldCapture, DidCapture} from './ReactSideEffectTags';
98
99
import {debugRenderPhaseSideEffectsForStrictMode} from 'shared/ReactFeatureFlags';
@@ -102,10 +102,10 @@ import {StrictMode} from './ReactTypeOfMode';
102
import {
103
markRenderEventTimeAndConfig,
104
markUnprocessedUpdateTime,
105
-} from './ReactFiberWorkLoop';
105
+} from './ReactFiberWorkLoop.old';
106
107
import invariant from 'shared/invariant';
108
-import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration';
108
+import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration.old';
109
110
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
111
packages/react-reconciler/src/SchedulerWithReactIntegration.old.js
renamed
packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.internal.js
+8
-5
@@ -18,11 +18,14 @@ describe('ReactIncrementalErrorReplay-test', () => {
18
// We almost always try to avoid such tests, but here the cost of
19
// the list getting out of sync (and causing subtle bugs in rare cases)
20
// is higher than the cost of maintaining the test.
21
- const {
22
- // This is the method we're going to test.
23
- // If this is no longer used, you can delete this test file.
24
- assignFiberPropertiesInDEV,
25
- } = require('../ReactFiber');
21
+
22
+ // This is the method we're going to test.
23
+ // If this is no longer used, you can delete this test file.;
24
+
25
+ const assignFiberPropertiesInDEV = require('shared/ReactFeatureFlags')
26
+ ? // TODO: Update this to point to the new module, once it exists
27
+ require('../ReactFiber.old').assignFiberPropertiesInDEV
28
+ : require('../ReactFiber.old').assignFiberPropertiesInDEV;
29
30
// Get a real fiber.
31
const realFiber = ReactTestRenderer.create(<div />).root._currentFiber();
packages/react-reconciler/src/forks/ReactFiberErrorDialog.native.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from '../ReactFiber';
10
+import type {Fiber} from '../ReactFiber.old';
11
import type {CapturedValue} from '../ReactCapturedValue';
12
13
import {ClassComponent} from '../ReactWorkTags';
packages/react-reconciler/src/forks/ReactFiberErrorDialog.www.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from '../ReactFiber';
10
+import type {Fiber} from '../ReactFiber.old';
11
import type {CapturedValue} from '../ReactCapturedValue';
12
13
import {ClassComponent} from '../ReactWorkTags';
packages/react-refresh/src/ReactFreshRuntime.js
+1
-1
@@ -8,7 +8,7 @@
8
*/
9
10
import type {Instance} from 'react-reconciler/src/ReactFiberHostConfig';
11
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
11
+import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
12
import type {
13
Family,
14
RefreshUpdate,
packages/react-test-renderer/src/ReactTestRenderer.js
+2
-2
@@ -7,8 +7,8 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
11
-import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
+import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
12
import type {Instance, TextInstance} from './ReactTestHostConfig';
13
14
import * as Scheduler from 'scheduler/unstable_mock';
packages/react/src/ReactBatchConfig.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
10
+import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
11
12
import ReactCurrentBatchConfig from './ReactCurrentBatchConfig';
13
packages/react/src/ReactCurrentBatchConfig.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
10
+import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
11
12
/**
13
* Keeps track of the current batch's configuration such as how long an update
packages/react/src/ReactCurrentDispatcher.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Dispatcher} from 'react-reconciler/src/ReactFiberHooks';
10
+import type {Dispatcher} from 'react-reconciler/src/ReactFiberHooks.old';
11
12
/**
13
* Keeps track of the current dispatcher.
packages/react/src/ReactCurrentOwner.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
10
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
11
12
/**
13
* Keeps track of the current owner.
scripts/flow/react-native-host-hooks.js
+1
-1
@@ -18,7 +18,7 @@ import type {
18
} from 'react-native-renderer/src/ReactNativeTypes';
19
import type {RNTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
20
import type {CapturedError} from 'react-reconciler/src/ReactCapturedValue';
21
-import type {Fiber} from 'react-reconciler/src/ReactFiber';
21
+import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
22
23
type DeepDifferOptions = {|+unsafelyIgnoreFunctions?: boolean|};
24
scripts/rollup/forks.js
+21
@@ -281,6 +281,27 @@ const forks = Object.freeze({
281
return 'react-reconciler/src/ReactFiberReconciler.old.js';
282
},
283
284
+ 'react-reconciler/src/ReactFiberHotReloading': (
285
+ bundleType,
286
+ entry,
287
+ dependencies,
288
+ moduleType,
289
+ bundle
290
+ ) => {
291
+ if (bundle.enableNewReconciler) {
292
+ switch (bundleType) {
293
+ case FB_WWW_DEV:
294
+ case FB_WWW_PROD:
295
+ case FB_WWW_PROFILING:
296
+ // Use the forked version of the reconciler
297
+ // TODO: Update this to point to the new module, once it exists
298
+ return 'react-reconciler/src/ReactFiberHotReloading.old.js';
299
+ }
300
+ }
301
+ // Otherwise, use the non-forked version.
302
+ return 'react-reconciler/src/ReactFiberHotReloading.old.js';
303
+ },
304
+
305
// Different dialogs for caught errors.
306
'react-reconciler/src/ReactFiberErrorDialog': (bundleType, entry) => {
307
switch (bundleType) {