@samitouri / QOS-React-2 / commits / 376d5c1b5a

Split cross-package types from implementation

Some of our internal reconciler types have leaked into other packages. Usually, these types are treated as opaque; we don't read and write to its fields. This is good. However, the type is often passed back to a reconciler method. For example, React DOM creates a FiberRoot with `createContainer`, then passes that root to `updateContainer`. It doesn't do anything with the root except pass it through, but because `updateContainer` expects a full FiberRoot, React DOM is still coupled to all its fields. I don't know if there's an idiomatic way to handle this in Flow. Opaque types are simlar, but those only work within a single file. AFAIK, there's no way to use a package as the boundary for opaqueness. The immediate problem this presents is that the reconciler refactor will involve changes to our internal data structures. I don't want to have to fork every single package that happens to pass through a Fiber or FiberRoot, or access any one of its fields. So my current plan is to share the same Flow type across both forks. The shared type will be a superset of each implementation's type, e.g. Fiber will have both an `expirationTime` field and a `lanes` field. The implementations will diverge, but not the types. To do this, I lifted the type definitions into a separate module.

Andrew Clark committed Apr 8, 2020 at 23:48 UTC 376d5c1b5aa17724c5fea9412f8fcde14a7b23f1
69 files changed +490 -438
packages/legacy-events/PluginModuleType.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
11 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
12 import type {EventPriority} from 'shared/ReactTypes';
13 import type {TopLevelType} from './TopLevelEventTypes';
14
packages/react-debug-tools/src/ReactDebugHooks.js
+14 -7
@@ -17,15 +17,13 @@ import type {
17 ReactEventResponderListener,
18 ReactScopeMethods,
19 } from 'shared/ReactTypes';
20 -import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
21 -import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
22 -
20 import type {
24 - Hook,
25 - TimeoutConfig,
21 + Fiber,
22 Dispatcher as DispatcherType,
27 -} from 'react-reconciler/src/ReactFiberHooks.old';
28 -import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
23 +} from 'react-reconciler/src/ReactInternalTypes';
24 +import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
25 +
26 +import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
27 import {NoMode} from 'react-reconciler/src/ReactTypeOfMode';
28
29 import ErrorStackParser from 'error-stack-parser';
@@ -70,6 +68,15 @@ let primitiveStackCache: null | Map<string, Array<any>> = null;
68
69 let currentFiber: Fiber | null = null;
70
71 +type Hook = {
72 + memoizedState: any,
73 + next: Hook | null,
74 +};
75 +
76 +type TimeoutConfig = {|
77 + timeoutMs: number,
78 +|};
79 +
80 function getPrimitiveStackCache(): Map<string, Array<any>> {
81 // This initializes a cache of all primitive hooks so that the top
82 // most stack frames added by calling the primitive hook can be removed.
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.old';
13 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
53 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
12 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
11 import type {
12 Container,
13 TextInstance,
packages/react-dom/src/client/ReactDOMRoot.js
+1 -3
@@ -10,9 +10,7 @@
10 import type {Container} from './ReactDOMHostConfig';
11 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.old';
13 +import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
14 import {findHostInstanceWithNoPortals} from 'react-reconciler/src/ReactFiberReconciler';
15
16 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.old';
14 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
18 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
34 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
12 +import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
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.old';
15 +import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
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.old';
15 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
16 import type {PluginModule} from 'legacy-events/PluginModuleType';
17 import type {EventSystemFlags} from './EventSystemFlags';
18
packages/react-dom/src/events/accumulateEnterLeaveListeners.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
11 import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
12
13 import {HostComponent} from 'react-reconciler/src/ReactWorkTags';
packages/react-dom/src/events/accumulateEventTargetListeners.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
11 import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
12 import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
13
packages/react-dom/src/events/accumulateTwoPhaseListeners.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
11 import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
12 import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
13
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.old';
9 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
10 import type {Props} from '../client/ReactDOMHostConfig';
11
12 import invariant from 'shared/invariant';
packages/react-dom/src/server/ReactPartialRendererHooks.js
+6 -5
@@ -7,10 +7,7 @@
7 * @flow
8 */
9
10 -import type {
11 - Dispatcher as DispatcherType,
12 - TimeoutConfig,
13 -} from 'react-reconciler/src/ReactFiberHooks.old';
10 +import type {Dispatcher as DispatcherType} from 'react-reconciler/src/ReactInternalTypes';
11 import type {ThreadID} from './ReactThreadIDAllocator';
12 import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
13
@@ -21,7 +18,7 @@ import type {
18 ReactContext,
19 ReactEventResponderListener,
20 } from 'shared/ReactTypes';
24 -import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
21 +import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
22 import type {ReactDOMListenerMap} from '../shared/ReactDOMTypes';
23
24 import {validateContextBounds} from './ReactPartialRendererContext';
@@ -49,6 +46,10 @@ type Hook = {|
46 next: Hook | null,
47 |};
48
49 +type TimeoutConfig = {|
50 + timeoutMs: number,
51 +|};
52 +
53 let currentlyRenderingComponent: Object | null = null;
54 let firstWorkInProgressHook: Hook | null = null;
55 let workInProgressHook: Hook | null = null;
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.old';
11 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
11 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
9 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
17 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
13
packages/react-reconciler/src/ReactChildFiber.old.js
+2 -2
@@ -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.old';
15 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
14 +import type {Fiber} from './ReactInternalTypes';
15 +import type {ExpirationTime} from './ReactFiberExpirationTime';
16
17 import getComponentName from 'shared/getComponentName';
18 import {Placement, Deletion} from './ReactSideEffectTags';
packages/react-reconciler/src/ReactCurrentFiber.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 import ReactSharedInternals from 'shared/ReactSharedInternals';
13 import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
packages/react-reconciler/src/ReactFiber.old.js
+6 -153
@@ -7,24 +7,18 @@
7 * @flow
8 */
9
10 -import type {ReactElement, Source} from 'shared/ReactElementType';
10 +import type {ReactElement} from 'shared/ReactElementType';
11 import type {
12 ReactFragment,
13 ReactPortal,
14 - RefObject,
15 - ReactEventResponder,
16 - ReactEventResponderInstance,
14 ReactFundamentalComponent,
15 ReactScope,
16 } from 'shared/ReactTypes';
17 +import type {Fiber} from './ReactInternalTypes';
18 import type {RootTag} from './ReactRootTags';
19 import type {WorkTag} from './ReactWorkTags';
20 import type {TypeOfMode} from './ReactTypeOfMode';
23 -import type {SideEffectTag} from './ReactSideEffectTags';
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';
21 +import type {ExpirationTime} from './ReactFiberExpirationTime';
22 import type {SuspenseInstance} from './ReactFiberHostConfig';
23
24 import invariant from 'shared/invariant';
@@ -69,7 +63,7 @@ import {
63 resolveFunctionForHotReloading,
64 resolveForwardRefForHotReloading,
65 } from './ReactFiberHotReloading.old';
72 -import {NoWork} from './ReactFiberExpirationTime.old';
66 +import {NoWork} from './ReactFiberExpirationTime';
67 import {
68 NoMode,
69 ConcurrentMode,
@@ -93,6 +87,8 @@ import {
87 REACT_BLOCK_TYPE,
88 } from 'shared/ReactSymbols';
89
90 +export type {Fiber};
91 +
92 let hasBadMapPolyfill;
93
94 if (__DEV__) {
@@ -109,149 +105,6 @@ if (__DEV__) {
105 }
106 }
107
112 -export type Dependencies = {
113 - expirationTime: ExpirationTime,
114 - firstContext: ContextDependency<mixed> | null,
115 - responders: Map<
116 - ReactEventResponder<any, any>,
117 - ReactEventResponderInstance<any, any>,
118 - > | null,
119 - ...
120 -};
121 -
122 -// A Fiber is work on a Component that needs to be done or was done. There can
123 -// be more than one per component.
124 -export type Fiber = {|
125 - // These first fields are conceptually members of an Instance. This used to
126 - // be split into a separate type and intersected with the other Fiber fields,
127 - // but until Flow fixes its intersection bugs, we've merged them into a
128 - // single type.
129 -
130 - // An Instance is shared between all versions of a component. We can easily
131 - // break this out into a separate object to avoid copying so much to the
132 - // alternate versions of the tree. We put this on a single object for now to
133 - // minimize the number of objects created during the initial render.
134 -
135 - // Tag identifying the type of fiber.
136 - tag: WorkTag,
137 -
138 - // Unique identifier of this child.
139 - key: null | string,
140 -
141 - // The value of element.type which is used to preserve the identity during
142 - // reconciliation of this child.
143 - elementType: any,
144 -
145 - // The resolved function/class/ associated with this fiber.
146 - type: any,
147 -
148 - // The local state associated with this fiber.
149 - stateNode: any,
150 -
151 - // Conceptual aliases
152 - // parent : Instance -> return The parent happens to be the same as the
153 - // return fiber since we've merged the fiber and instance.
154 -
155 - // Remaining fields belong to Fiber
156 -
157 - // The Fiber to return to after finishing processing this one.
158 - // This is effectively the parent, but there can be multiple parents (two)
159 - // so this is only the parent of the thing we're currently processing.
160 - // It is conceptually the same as the return address of a stack frame.
161 - return: Fiber | null,
162 -
163 - // Singly Linked List Tree Structure.
164 - child: Fiber | null,
165 - sibling: Fiber | null,
166 - index: number,
167 -
168 - // The ref last used to attach this node.
169 - // I'll avoid adding an owner field for prod and model that as functions.
170 - ref:
171 - | null
172 - | (((handle: mixed) => void) & {_stringRef: ?string, ...})
173 - | RefObject,
174 -
175 - // Input is the data coming into process this fiber. Arguments. Props.
176 - pendingProps: any, // This type will be more specific once we overload the tag.
177 - memoizedProps: any, // The props used to create the output.
178 -
179 - // A queue of state updates and callbacks.
180 - updateQueue: UpdateQueue<any> | null,
181 -
182 - // The state used to create the output
183 - memoizedState: any,
184 -
185 - // Dependencies (contexts, events) for this fiber, if it has any
186 - dependencies: Dependencies | null,
187 -
188 - // Bitfield that describes properties about the fiber and its subtree. E.g.
189 - // the ConcurrentMode flag indicates whether the subtree should be async-by-
190 - // default. When a fiber is created, it inherits the mode of its
191 - // parent. Additional flags can be set at creation time, but after that the
192 - // value should remain unchanged throughout the fiber's lifetime, particularly
193 - // before its child fibers are created.
194 - mode: TypeOfMode,
195 -
196 - // Effect
197 - effectTag: SideEffectTag,
198 -
199 - // Singly linked list fast path to the next fiber with side-effects.
200 - nextEffect: Fiber | null,
201 -
202 - // The first and last fiber with side-effect within this subtree. This allows
203 - // us to reuse a slice of the linked list when we reuse the work done within
204 - // this fiber.
205 - firstEffect: Fiber | null,
206 - lastEffect: Fiber | null,
207 -
208 - // Represents a time in the future by which this work should be completed.
209 - // Does not include work found in its subtree.
210 - expirationTime: ExpirationTime,
211 -
212 - // This is used to quickly determine if a subtree has no pending changes.
213 - childExpirationTime: ExpirationTime,
214 -
215 - // This is a pooled version of a Fiber. Every fiber that gets updated will
216 - // eventually have a pair. There are cases when we can clean up pairs to save
217 - // memory if we need to.
218 - alternate: Fiber | null,
219 -
220 - // Time spent rendering this Fiber and its descendants for the current update.
221 - // This tells us how well the tree makes use of sCU for memoization.
222 - // It is reset to 0 each time we render and only updated when we don't bailout.
223 - // This field is only set when the enableProfilerTimer flag is enabled.
224 - actualDuration?: number,
225 -
226 - // If the Fiber is currently active in the "render" phase,
227 - // This marks the time at which the work began.
228 - // This field is only set when the enableProfilerTimer flag is enabled.
229 - actualStartTime?: number,
230 -
231 - // Duration of the most recent render time for this Fiber.
232 - // This value is not updated when we bailout for memoization purposes.
233 - // This field is only set when the enableProfilerTimer flag is enabled.
234 - selfBaseDuration?: number,
235 -
236 - // Sum of base times for all descendants of this Fiber.
237 - // This value bubbles up during the "complete" phase.
238 - // This field is only set when the enableProfilerTimer flag is enabled.
239 - treeBaseDuration?: number,
240 -
241 - // Conceptual aliases
242 - // workInProgress : Fiber -> alternate The alternate used for reuse happens
243 - // to be the same as work in progress.
244 - // __DEV__ only
245 - _debugID?: number,
246 - _debugSource?: Source | null,
247 - _debugOwner?: Fiber | null,
248 - _debugIsCurrentlyTiming?: boolean,
249 - _debugNeedsRemount?: boolean,
250 -
251 - // Used to verify that the order of hooks does not change between renders.
252 - _debugHookTypes?: Array<HookType> | null,
253 -|};
254 -
108 let debugCounter = 1;
109
110 function FiberNode(
packages/react-reconciler/src/ReactFiberBeginWork.old.js
+4 -4
@@ -10,9 +10,9 @@
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.old';
14 -import type {FiberRoot} from './ReactFiberRoot.old';
15 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
13 +import type {Fiber} from './ReactInternalTypes';
14 +import type {FiberRoot} from './ReactInternalTypes';
15 +import type {ExpirationTime} from './ReactFiberExpirationTime';
16 import type {
17 SuspenseState,
18 SuspenseListRenderState,
@@ -100,7 +100,7 @@ import {
100 Never,
101 Sync,
102 computeAsyncExpiration,
103 -} from './ReactFiberExpirationTime.old';
103 +} from './ReactFiberExpirationTime';
104 import {
105 ConcurrentMode,
106 NoMode,
packages/react-reconciler/src/ReactFiberClassComponent.old.js
+4 -4
@@ -7,8 +7,8 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 +import type {ExpirationTime} from './ReactFiberExpirationTime';
12 import type {UpdateQueue} from './ReactUpdateQueue.old';
13
14 import * as React from 'react';
@@ -40,7 +40,7 @@ import {
40 initializeUpdateQueue,
41 cloneUpdateQueue,
42 } from './ReactUpdateQueue.old';
43 -import {NoWork} from './ReactFiberExpirationTime.old';
43 +import {NoWork} from './ReactFiberExpirationTime';
44 import {
45 cacheContext,
46 getMaskedContext,
@@ -54,7 +54,7 @@ import {
54 computeExpirationForFiber,
55 scheduleUpdateOnFiber,
56 } from './ReactFiberWorkLoop.old';
57 -import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
57 +import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
58
59 import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
60
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+16 -6
@@ -15,13 +15,14 @@ import type {
15 ChildSet,
16 UpdatePayload,
17 } from './ReactFiberHostConfig';
18 -import type {Fiber} from './ReactFiber.old';
19 -import type {FiberRoot} from './ReactFiberRoot.old';
20 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
18 +import type {Fiber} from './ReactInternalTypes';
19 +import type {FiberRoot} from './ReactInternalTypes';
20 +import type {ExpirationTime} from './ReactFiberExpirationTime';
21 import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
22 +import type {UpdateQueue} from './ReactUpdateQueue.old';
23 import type {FunctionComponentUpdateQueue} from './ReactFiberHooks.old';
24 import type {Wakeable} from 'shared/ReactTypes';
24 -import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
25 +import type {ReactPriorityLevel} from './ReactInternalTypes';
26
27 import {unstable_wrap as Schedule_tracing_wrap} from 'scheduler/tracing';
28 import {
@@ -643,7 +644,12 @@ function commitLifeCycles(
644 }
645 }
646 }
646 - const updateQueue = finishedWork.updateQueue;
647 +
648 + // TODO: I think this is now always non-null by the time it reaches the
649 + // commit phase. Consider removing the type check.
650 + const updateQueue: UpdateQueue<
651 + *,
652 + > | null = (finishedWork.updateQueue: any);
653 if (updateQueue !== null) {
654 if (__DEV__) {
655 if (
@@ -680,7 +686,11 @@ function commitLifeCycles(
686 return;
687 }
688 case HostRoot: {
683 - const updateQueue = finishedWork.updateQueue;
689 + // TODO: I think this is now always non-null by the time it reaches the
690 + // commit phase. Consider removing the type check.
691 + const updateQueue: UpdateQueue<
692 + *,
693 + > | null = (finishedWork.updateQueue: any);
694 if (updateQueue !== null) {
695 let instance = null;
696 if (finishedWork.child !== null) {
packages/react-reconciler/src/ReactFiberCompleteWork.old.js
+4 -4
@@ -7,13 +7,13 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 +import type {ExpirationTime} from './ReactFiberExpirationTime';
12 import type {
13 ReactFundamentalComponentInstance,
14 ReactScopeInstance,
15 } from 'shared/ReactTypes';
16 -import type {FiberRoot} from './ReactFiberRoot.old';
16 +import type {FiberRoot} from './ReactInternalTypes';
17 import type {
18 Instance,
19 Type,
@@ -129,7 +129,7 @@ import {
129 renderHasNotSuspendedYet,
130 } from './ReactFiberWorkLoop.old';
131 import {createFundamentalStateInstance} from './ReactFiberFundamental.old';
132 -import {Never} from './ReactFiberExpirationTime.old';
132 +import {Never} from './ReactFiberExpirationTime';
133 import {resetChildFibers} from './ReactChildFiber.old';
134 import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents.old';
135 import {createScopeMethods} from './ReactFiberScope.old';
packages/react-reconciler/src/ReactFiberComponentStack.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 import {
13 HostComponent,
packages/react-reconciler/src/ReactFiberContext.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {StackCursor} from './ReactFiberStack.old';
12
13 import {isFiberMounted} from './ReactFiberTreeReflection';
packages/react-reconciler/src/ReactFiberDeprecatedEvents.old.js
+2 -2
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
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.old';
22 +import {NoWork} from './ReactFiberExpirationTime';
23
24 import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
25
packages/react-reconciler/src/ReactFiberDevToolsHook.old.js
+4 -4
@@ -9,11 +9,11 @@
9
10 import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
11 import {getCurrentTime} from './ReactFiberWorkLoop.old';
12 -import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime.old';
12 +import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime';
13
14 -import type {Fiber} from './ReactFiber.old';
15 -import type {FiberRoot} from './ReactFiberRoot.old';
16 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
14 +import type {Fiber} from './ReactInternalTypes';
15 +import type {FiberRoot} from './ReactInternalTypes';
16 +import type {ExpirationTime} from './ReactFiberExpirationTime';
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.old';
10 +import type {Fiber} from './ReactInternalTypes';
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.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {CapturedValue} from './ReactCapturedValue';
12
13 import {showErrorDialog} from './ReactFiberErrorDialog';
packages/react-reconciler/src/ReactFiberExpirationTime.js renamed
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
10 +import type {ReactPriorityLevel} from './ReactInternalTypes';
11
12 import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
13
packages/react-reconciler/src/ReactFiberFundamental.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {
12 ReactFundamentalImpl,
13 ReactFundamentalComponentInstance,
packages/react-reconciler/src/ReactFiberHooks.old.js
+8 -57
@@ -16,12 +16,12 @@ import type {
16 ReactEventResponderListener,
17 ReactScopeMethods,
18 } from 'shared/ReactTypes';
19 -import type {Fiber} from './ReactFiber.old';
20 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
19 +import type {Fiber, Dispatcher} from './ReactInternalTypes';
20 +import type {ExpirationTime} from './ReactFiberExpirationTime';
21 import type {HookEffectTag} from './ReactHookEffectTags';
22 -import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
23 -import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
24 -import type {FiberRoot} from './ReactFiberRoot.old';
22 +import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
23 +import type {ReactPriorityLevel} from './ReactInternalTypes';
24 +import type {FiberRoot} from './ReactInternalTypes';
25 import type {
26 OpaqueIDType,
27 ReactListenerEvent,
@@ -33,7 +33,7 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
33 import {enableUseEventAPI} from 'shared/ReactFeatureFlags';
34
35 import {markRootExpiredAtTime} from './ReactFiberRoot.old';
36 -import {NoWork, Sync} from './ReactFiberExpirationTime.old';
36 +import {NoWork, Sync} from './ReactFiberExpirationTime';
37 import {NoMode, BlockingMode} from './ReactTypeOfMode';
38 import {readContext} from './ReactFiberNewContext.old';
39 import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents.old';
@@ -69,7 +69,7 @@ import invariant from 'shared/invariant';
69 import getComponentName from 'shared/getComponentName';
70 import is from 'shared/objectIs';
71 import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
72 -import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
72 +import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
73 import {
74 UserBlockingPriority,
75 NormalPriority,
@@ -95,55 +95,6 @@ import {getIsRendering} from './ReactCurrentFiber';
95
96 const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
97
98 -export type Dispatcher = {|
99 - readContext<T>(
100 - context: ReactContext<T>,
101 - observedBits: void | number | boolean,
102 - ): T,
103 - useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>],
104 - useReducer<S, I, A>(
105 - reducer: (S, A) => S,
106 - initialArg: I,
107 - init?: (I) => S,
108 - ): [S, Dispatch<A>],
109 - useContext<T>(
110 - context: ReactContext<T>,
111 - observedBits: void | number | boolean,
112 - ): T,
113 - useRef<T>(initialValue: T): {|current: T|},
114 - useEffect(
115 - create: () => (() => void) | void,
116 - deps: Array<mixed> | void | null,
117 - ): void,
118 - useLayoutEffect(
119 - create: () => (() => void) | void,
120 - deps: Array<mixed> | void | null,
121 - ): void,
122 - useCallback<T>(callback: T, deps: Array<mixed> | void | null): T,
123 - useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T,
124 - useImperativeHandle<T>(
125 - ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
126 - create: () => T,
127 - deps: Array<mixed> | void | null,
128 - ): void,
129 - useDebugValue<T>(value: T, formatterFn: ?(value: T) => mixed): void,
130 - useResponder<E, C>(
131 - responder: ReactEventResponder<E, C>,
132 - props: Object,
133 - ): ReactEventResponderListener<E, C>,
134 - useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T,
135 - useTransition(
136 - config: SuspenseConfig | void | null,
137 - ): [(() => void) => void, boolean],
138 - useMutableSource<Source, Snapshot>(
139 - source: MutableSource<Source>,
140 - getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>,
141 - subscribe: MutableSourceSubscribeFn<Source, Snapshot>,
142 - ): Snapshot,
143 - useEvent(event: ReactListenerEvent): ReactListenerMap,
144 - useOpaqueIdentifier(): OpaqueIDType | void,
145 -|};
146 -
98 type Update<S, A> = {|
99 expirationTime: ExpirationTime,
100 suspenseConfig: null | SuspenseConfig,
@@ -204,7 +155,7 @@ export type Effect = {|
155
156 export type FunctionComponentUpdateQueue = {|lastEffect: Effect | null|};
157
207 -export type TimeoutConfig = {|
158 +type TimeoutConfig = {|
159 timeoutMs: number,
160 |};
161
packages/react-reconciler/src/ReactFiberHostContext.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {StackCursor} from './ReactFiberStack.old';
12 import type {Container, HostContext} from './ReactFiberHostConfig';
13
packages/react-reconciler/src/ReactFiberHotReloading.old.js
+3 -3
@@ -8,8 +8,8 @@
8 */
9
10 import type {ReactElement} from 'shared/ReactElementType';
11 -import type {Fiber} from './ReactFiber.old';
12 -import type {FiberRoot} from './ReactFiberRoot.old';
11 +import type {Fiber} from './ReactInternalTypes';
12 +import type {FiberRoot} from './ReactInternalTypes';
13 import type {Instance} from './ReactFiberHostConfig';
14 import type {ReactNodeList} from 'shared/ReactTypes';
15
@@ -20,7 +20,7 @@ import {
20 } from './ReactFiberWorkLoop.old';
21 import {updateContainer, syncUpdates} from './ReactFiberReconciler.old';
22 import {emptyContextObject} from './ReactFiberContext.old';
23 -import {Sync} from './ReactFiberExpirationTime.old';
23 +import {Sync} from './ReactFiberExpirationTime';
24 import {
25 ClassComponent,
26 FunctionComponent,
packages/react-reconciler/src/ReactFiberHydrationContext.old.js
+2 -2
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {
12 Instance,
13 TextInstance,
@@ -55,7 +55,7 @@ import {
55 didNotFindHydratableSuspenseInstance,
56 } from './ReactFiberHostConfig';
57 import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
58 -import {Never, NoWork} from './ReactFiberExpirationTime.old';
58 +import {Never, NoWork} from './ReactFiberExpirationTime';
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/ReactFiberNewContext.old.js
+3 -10
@@ -8,16 +8,9 @@
8 */
9
10 import type {ReactContext} from 'shared/ReactTypes';
11 -import type {Fiber} from './ReactFiber.old';
11 +import type {Fiber, ContextDependency} from './ReactInternalTypes';
12 import type {StackCursor} from './ReactFiberStack.old';
13 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
14 -
15 -export type ContextDependency<T> = {
16 - context: ReactContext<T>,
17 - observedBits: number,
18 - next: ContextDependency<mixed> | null,
19 - ...
20 -};
13 +import type {ExpirationTime} from './ReactFiberExpirationTime';
14
15 import {isPrimaryRenderer} from './ReactFiberHostConfig';
16 import {createCursor, push, pop} from './ReactFiberStack.old';
@@ -31,7 +24,7 @@ import {
24 import invariant from 'shared/invariant';
25 import is from 'shared/objectIs';
26 import {createUpdate, enqueueUpdate, ForceUpdate} from './ReactUpdateQueue.old';
34 -import {NoWork} from './ReactFiberExpirationTime.old';
27 +import {NoWork} from './ReactFiberExpirationTime';
28 import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
29 import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
30
packages/react-reconciler/src/ReactFiberReconciler.old.js
+6 -9
@@ -7,8 +7,8 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {FiberRoot} from './ReactFiberRoot.old';
10 +import type {Fiber, SuspenseHydrationCallbacks} from './ReactInternalTypes';
11 +import type {FiberRoot} from './ReactInternalTypes';
12 import type {RootTag} from './ReactRootTags';
13 import type {
14 Instance,
@@ -19,11 +19,8 @@ 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.old';
23 -import type {
24 - SuspenseHydrationCallbacks,
25 - SuspenseState,
26 -} from './ReactFiberSuspenseComponent.old';
22 +import type {ExpirationTime} from './ReactFiberExpirationTime';
23 +import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
24
25 import {
26 findCurrentHostFiber,
@@ -79,8 +76,8 @@ import {
76 Sync,
77 ContinuousHydration,
78 computeInteractiveExpiration,
82 -} from './ReactFiberExpirationTime.old';
83 -import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
79 +} from './ReactFiberExpirationTime';
80 +import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
81 import {
82 scheduleRefresh,
83 scheduleRoot,
packages/react-reconciler/src/ReactFiberRoot.old.js
+3 -89
@@ -7,18 +7,13 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
10 +import type {FiberRoot, SuspenseHydrationCallbacks} from './ReactInternalTypes';
11 +import type {ExpirationTime} from './ReactFiberExpirationTime';
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.old';
17 -import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
13
14 import {noTimeout} from './ReactFiberHostConfig';
15 import {createHostRootFiber} from './ReactFiber.old';
21 -import {NoWork} from './ReactFiberExpirationTime.old';
16 +import {NoWork} from './ReactFiberExpirationTime';
17 import {
18 enableSchedulerTracing,
19 enableSuspenseCallback,
@@ -28,87 +23,6 @@ import {NoPriority} from './SchedulerWithReactIntegration.old';
23 import {initializeUpdateQueue} from './ReactUpdateQueue.old';
24 import {clearPendingUpdates as clearPendingMutableSourceUpdates} from './ReactMutableSource.old';
25
31 -export type PendingInteractionMap = Map<ExpirationTime, Set<Interaction>>;
32 -
33 -type BaseFiberRootProperties = {|
34 - // The type of root (legacy, batched, concurrent, etc.)
35 - tag: RootTag,
36 -
37 - // Any additional information from the host associated with this root.
38 - containerInfo: any,
39 - // Used only by persistent updates.
40 - pendingChildren: any,
41 - // The currently active root fiber. This is the mutable root of the tree.
42 - current: Fiber,
43 -
44 - pingCache:
45 - | WeakMap<Wakeable, Set<ExpirationTime>>
46 - | Map<Wakeable, Set<ExpirationTime>>
47 - | null,
48 -
49 - finishedExpirationTime: ExpirationTime,
50 - // A finished work-in-progress HostRoot that's ready to be committed.
51 - finishedWork: Fiber | null,
52 - // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if
53 - // it's superseded by a new one.
54 - timeoutHandle: TimeoutHandle | NoTimeout,
55 - // Top context object, used by renderSubtreeIntoContainer
56 - context: Object | null,
57 - pendingContext: Object | null,
58 - // Determines if we should attempt to hydrate on the initial mount
59 - +hydrate: boolean,
60 - // Node returned by Scheduler.scheduleCallback
61 - callbackNode: *,
62 - // Expiration of the callback associated with this root
63 - callbackExpirationTime: ExpirationTime,
64 - // Priority of the callback associated with this root
65 - callbackPriority: ReactPriorityLevel,
66 - // The earliest pending expiration time that exists in the tree
67 - firstPendingTime: ExpirationTime,
68 - // The latest pending expiration time that exists in the tree
69 - lastPendingTime: ExpirationTime,
70 - // The earliest suspended expiration time that exists in the tree
71 - firstSuspendedTime: ExpirationTime,
72 - // The latest suspended expiration time that exists in the tree
73 - lastSuspendedTime: ExpirationTime,
74 - // The next known expiration time after the suspended range
75 - nextKnownPendingLevel: ExpirationTime,
76 - // The latest time at which a suspended component pinged the root to
77 - // render again
78 - lastPingedTime: ExpirationTime,
79 - lastExpiredTime: ExpirationTime,
80 - // Used by useMutableSource hook to avoid tearing within this root
81 - // when external, mutable sources are read from during render.
82 - mutableSourceLastPendingUpdateTime: ExpirationTime,
83 -|};
84 -
85 -// The following attributes are only used by interaction tracing builds.
86 -// They enable interactions to be associated with their async work,
87 -// And expose interaction metadata to the React DevTools Profiler plugin.
88 -// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
89 -type ProfilingOnlyFiberRootProperties = {|
90 - interactionThreadID: number,
91 - memoizedInteractions: Set<Interaction>,
92 - pendingInteractionMap: PendingInteractionMap,
93 -|};
94 -
95 -// The follow fields are only used by enableSuspenseCallback for hydration.
96 -type SuspenseCallbackOnlyFiberRootProperties = {|
97 - hydrationCallbacks: null | SuspenseHydrationCallbacks,
98 -|};
99 -
100 -// Exported FiberRoot type includes all properties,
101 -// To avoid requiring potentially error-prone :any casts throughout the project.
102 -// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
103 -// The types are defined separately within this file to ensure they stay in sync.
104 -// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
105 -export type FiberRoot = {
106 - ...BaseFiberRootProperties,
107 - ...ProfilingOnlyFiberRootProperties,
108 - ...SuspenseCallbackOnlyFiberRootProperties,
109 - ...
110 -};
111 -
26 function FiberRootNode(containerInfo, tag, hydrate) {
27 this.tag = tag;
28 this.current = null;
packages/react-reconciler/src/ReactFiberScope.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {
12 ReactScope,
13 ReactScopeInstance,
packages/react-reconciler/src/ReactFiberStack.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 export type StackCursor<T> = {|current: T|};
13
packages/react-reconciler/src/ReactFiberSuspenseComponent.old.js
+2 -8
@@ -7,9 +7,9 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {SuspenseInstance} from './ReactFiberHostConfig';
12 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
12 +import type {ExpirationTime} from './ReactFiberExpirationTime';
13 import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
14 import {NoEffect, DidCapture} from './ReactSideEffectTags';
15 import {
@@ -17,12 +17,6 @@ import {
17 isSuspenseInstanceFallback,
18 } from './ReactFiberHostConfig';
19
20 -export type SuspenseHydrationCallbacks = {
21 - onHydrated?: (suspenseInstance: SuspenseInstance) => void,
22 - onDeleted?: (suspenseInstance: SuspenseInstance) => void,
23 - ...
24 -};
25 -
20 // A null SuspenseState represents an unsuspended normal Suspense boundary.
21 // A non-null SuspenseState means that it is blocked for one reason or another.
22 // - A non-null dehydrated field means it's blocked pending hydration.
packages/react-reconciler/src/ReactFiberSuspenseConfig.js renamed
+4
@@ -17,6 +17,10 @@ export type SuspenseConfig = {|
17 busyMinDurationMs?: number,
18 |};
19
20 +export type TimeoutConfig = {|
21 + timeoutMs: number,
22 +|};
23 +
24 export function requestCurrentSuspenseConfig(): null | SuspenseConfig {
25 return ReactCurrentBatchConfig.suspense;
26 }
packages/react-reconciler/src/ReactFiberSuspenseContext.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {StackCursor} from './ReactFiberStack.old';
12
13 import {createCursor, push, pop} from './ReactFiberStack.old';
packages/react-reconciler/src/ReactFiberThrow.old.js
+4 -4
@@ -7,9 +7,9 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {FiberRoot} from './ReactFiberRoot.old';
12 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 +import type {FiberRoot} from './ReactInternalTypes';
12 +import type {ExpirationTime} from './ReactFiberExpirationTime';
13 import type {CapturedValue} from './ReactCapturedValue';
14 import type {Update} from './ReactUpdateQueue.old';
15 import type {Wakeable} from 'shared/ReactTypes';
@@ -56,7 +56,7 @@ import {
56 } from './ReactFiberWorkLoop.old';
57 import {logCapturedError} from './ReactFiberErrorLogger';
58
59 -import {Sync} from './ReactFiberExpirationTime.old';
59 +import {Sync} from './ReactFiberExpirationTime';
60
61 const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
62
packages/react-reconciler/src/ReactFiberTreeReflection.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 import type {Container, SuspenseInstance} from './ReactFiberHostConfig';
12 import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
13
packages/react-reconciler/src/ReactFiberUnwindWork.old.js
+2 -2
@@ -7,8 +7,8 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
11 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
10 +import type {Fiber} from './ReactInternalTypes';
11 +import type {ExpirationTime} from './ReactFiberExpirationTime';
12 import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
13
14 import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+5 -6
@@ -8,12 +8,11 @@
8 */
9
10 import type {Wakeable} from 'shared/ReactTypes';
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';
11 +import type {Fiber, FiberRoot} from './ReactInternalTypes';
12 +import type {ExpirationTime} from './ReactFiberExpirationTime';
13 +import type {ReactPriorityLevel} from './ReactInternalTypes';
14 import type {Interaction} from 'scheduler/src/Tracing';
16 -import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
15 +import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
16 import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
17 import type {Effect as HookEffect} from './ReactFiberHooks.old';
18
@@ -125,7 +124,7 @@ import {
124 LOW_PRIORITY_EXPIRATION,
125 Batched,
126 Idle,
128 -} from './ReactFiberExpirationTime.old';
127 +} from './ReactFiberExpirationTime';
128 import {beginWork as originalBeginWork} from './ReactFiberBeginWork.old';
129 import {completeWork} from './ReactFiberCompleteWork.old';
130 import {unwindWork, unwindInterruptedWork} from './ReactFiberUnwindWork.old';
packages/react-reconciler/src/ReactInternalTypes.js new
+330
@@ -0,0 +1,330 @@
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 {Source} from 'shared/ReactElementType';
11 +import type {
12 + RefObject,
13 + ReactEventResponder,
14 + ReactEventResponderListener,
15 + ReactEventResponderInstance,
16 + ReactContext,
17 + MutableSourceSubscribeFn,
18 + MutableSourceGetSnapshotFn,
19 + MutableSource,
20 +} from 'shared/ReactTypes';
21 +import type {
22 + SuspenseInstance,
23 + ReactListenerEvent,
24 +} from './ReactFiberHostConfig';
25 +import type {WorkTag} from './ReactWorkTags';
26 +import type {TypeOfMode} from './ReactTypeOfMode';
27 +import type {SideEffectTag} from './ReactSideEffectTags';
28 +import type {ExpirationTime} from './ReactFiberExpirationTime';
29 +// import type {UpdateQueue} from './ReactUpdateQueue.old';
30 +import type {HookType} from './ReactFiberHooks.old';
31 +import type {RootTag} from './ReactRootTags';
32 +import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
33 +import type {Wakeable} from 'shared/ReactTypes';
34 +import type {Interaction} from 'scheduler/src/Tracing';
35 +import type {
36 + OpaqueIDType,
37 + ReactListenerMap,
38 +} from 'react-reconciler/src/ReactFiberHostConfig';
39 +import type {SuspenseConfig, TimeoutConfig} from './ReactFiberSuspenseConfig';
40 +
41 +export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90;
42 +
43 +export type ContextDependency<T> = {
44 + context: ReactContext<T>,
45 + observedBits: number,
46 + next: ContextDependency<mixed> | null,
47 + ...
48 +};
49 +
50 +export type Dependencies = {
51 + expirationTime: ExpirationTime,
52 + firstContext: ContextDependency<mixed> | null,
53 + responders: Map<
54 + ReactEventResponder<any, any>,
55 + ReactEventResponderInstance<any, any>,
56 + > | null,
57 + ...
58 +};
59 +
60 +// A Fiber is work on a Component that needs to be done or was done. There can
61 +// be more than one per component.
62 +export type Fiber = {|
63 + // These first fields are conceptually members of an Instance. This used to
64 + // be split into a separate type and intersected with the other Fiber fields,
65 + // but until Flow fixes its intersection bugs, we've merged them into a
66 + // single type.
67 +
68 + // An Instance is shared between all versions of a component. We can easily
69 + // break this out into a separate object to avoid copying so much to the
70 + // alternate versions of the tree. We put this on a single object for now to
71 + // minimize the number of objects created during the initial render.
72 +
73 + // Tag identifying the type of fiber.
74 + tag: WorkTag,
75 +
76 + // Unique identifier of this child.
77 + key: null | string,
78 +
79 + // The value of element.type which is used to preserve the identity during
80 + // reconciliation of this child.
81 + elementType: any,
82 +
83 + // The resolved function/class/ associated with this fiber.
84 + type: any,
85 +
86 + // The local state associated with this fiber.
87 + stateNode: any,
88 +
89 + // Conceptual aliases
90 + // parent : Instance -> return The parent happens to be the same as the
91 + // return fiber since we've merged the fiber and instance.
92 +
93 + // Remaining fields belong to Fiber
94 +
95 + // The Fiber to return to after finishing processing this one.
96 + // This is effectively the parent, but there can be multiple parents (two)
97 + // so this is only the parent of the thing we're currently processing.
98 + // It is conceptually the same as the return address of a stack frame.
99 + return: Fiber | null,
100 +
101 + // Singly Linked List Tree Structure.
102 + child: Fiber | null,
103 + sibling: Fiber | null,
104 + index: number,
105 +
106 + // The ref last used to attach this node.
107 + // I'll avoid adding an owner field for prod and model that as functions.
108 + ref:
109 + | null
110 + | (((handle: mixed) => void) & {_stringRef: ?string, ...})
111 + | RefObject,
112 +
113 + // Input is the data coming into process this fiber. Arguments. Props.
114 + pendingProps: any, // This type will be more specific once we overload the tag.
115 + memoizedProps: any, // The props used to create the output.
116 +
117 + // A queue of state updates and callbacks.
118 + updateQueue: mixed,
119 +
120 + // The state used to create the output
121 + memoizedState: any,
122 +
123 + // Dependencies (contexts, events) for this fiber, if it has any
124 + dependencies: Dependencies | null,
125 +
126 + // Bitfield that describes properties about the fiber and its subtree. E.g.
127 + // the ConcurrentMode flag indicates whether the subtree should be async-by-
128 + // default. When a fiber is created, it inherits the mode of its
129 + // parent. Additional flags can be set at creation time, but after that the
130 + // value should remain unchanged throughout the fiber's lifetime, particularly
131 + // before its child fibers are created.
132 + mode: TypeOfMode,
133 +
134 + // Effect
135 + effectTag: SideEffectTag,
136 +
137 + // Singly linked list fast path to the next fiber with side-effects.
138 + nextEffect: Fiber | null,
139 +
140 + // The first and last fiber with side-effect within this subtree. This allows
141 + // us to reuse a slice of the linked list when we reuse the work done within
142 + // this fiber.
143 + firstEffect: Fiber | null,
144 + lastEffect: Fiber | null,
145 +
146 + // Represents a time in the future by which this work should be completed.
147 + // Does not include work found in its subtree.
148 + expirationTime: ExpirationTime,
149 +
150 + // This is used to quickly determine if a subtree has no pending changes.
151 + childExpirationTime: ExpirationTime,
152 +
153 + // This is a pooled version of a Fiber. Every fiber that gets updated will
154 + // eventually have a pair. There are cases when we can clean up pairs to save
155 + // memory if we need to.
156 + alternate: Fiber | null,
157 +
158 + // Time spent rendering this Fiber and its descendants for the current update.
159 + // This tells us how well the tree makes use of sCU for memoization.
160 + // It is reset to 0 each time we render and only updated when we don't bailout.
161 + // This field is only set when the enableProfilerTimer flag is enabled.
162 + actualDuration?: number,
163 +
164 + // If the Fiber is currently active in the "render" phase,
165 + // This marks the time at which the work began.
166 + // This field is only set when the enableProfilerTimer flag is enabled.
167 + actualStartTime?: number,
168 +
169 + // Duration of the most recent render time for this Fiber.
170 + // This value is not updated when we bailout for memoization purposes.
171 + // This field is only set when the enableProfilerTimer flag is enabled.
172 + selfBaseDuration?: number,
173 +
174 + // Sum of base times for all descendants of this Fiber.
175 + // This value bubbles up during the "complete" phase.
176 + // This field is only set when the enableProfilerTimer flag is enabled.
177 + treeBaseDuration?: number,
178 +
179 + // Conceptual aliases
180 + // workInProgress : Fiber -> alternate The alternate used for reuse happens
181 + // to be the same as work in progress.
182 + // __DEV__ only
183 + _debugID?: number,
184 + _debugSource?: Source | null,
185 + _debugOwner?: Fiber | null,
186 + _debugIsCurrentlyTiming?: boolean,
187 + _debugNeedsRemount?: boolean,
188 +
189 + // Used to verify that the order of hooks does not change between renders.
190 + _debugHookTypes?: Array<HookType> | null,
191 +|};
192 +
193 +export type PendingInteractionMap = Map<ExpirationTime, Set<Interaction>>;
194 +
195 +type BaseFiberRootProperties = {|
196 + // The type of root (legacy, batched, concurrent, etc.)
197 + tag: RootTag,
198 +
199 + // Any additional information from the host associated with this root.
200 + containerInfo: any,
201 + // Used only by persistent updates.
202 + pendingChildren: any,
203 + // The currently active root fiber. This is the mutable root of the tree.
204 + current: Fiber,
205 +
206 + pingCache:
207 + | WeakMap<Wakeable, Set<ExpirationTime>>
208 + | Map<Wakeable, Set<ExpirationTime>>
209 + | null,
210 +
211 + finishedExpirationTime: ExpirationTime,
212 + // A finished work-in-progress HostRoot that's ready to be committed.
213 + finishedWork: Fiber | null,
214 + // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if
215 + // it's superseded by a new one.
216 + timeoutHandle: TimeoutHandle | NoTimeout,
217 + // Top context object, used by renderSubtreeIntoContainer
218 + context: Object | null,
219 + pendingContext: Object | null,
220 + // Determines if we should attempt to hydrate on the initial mount
221 + +hydrate: boolean,
222 + // Node returned by Scheduler.scheduleCallback
223 + callbackNode: *,
224 + // Expiration of the callback associated with this root
225 + callbackExpirationTime: ExpirationTime,
226 + // Priority of the callback associated with this root
227 + callbackPriority: ReactPriorityLevel,
228 + // The earliest pending expiration time that exists in the tree
229 + firstPendingTime: ExpirationTime,
230 + // The latest pending expiration time that exists in the tree
231 + lastPendingTime: ExpirationTime,
232 + // The earliest suspended expiration time that exists in the tree
233 + firstSuspendedTime: ExpirationTime,
234 + // The latest suspended expiration time that exists in the tree
235 + lastSuspendedTime: ExpirationTime,
236 + // The next known expiration time after the suspended range
237 + nextKnownPendingLevel: ExpirationTime,
238 + // The latest time at which a suspended component pinged the root to
239 + // render again
240 + lastPingedTime: ExpirationTime,
241 + lastExpiredTime: ExpirationTime,
242 + // Used by useMutableSource hook to avoid tearing within this root
243 + // when external, mutable sources are read from during render.
244 + mutableSourceLastPendingUpdateTime: ExpirationTime,
245 +|};
246 +
247 +// The following attributes are only used by interaction tracing builds.
248 +// They enable interactions to be associated with their async work,
249 +// And expose interaction metadata to the React DevTools Profiler plugin.
250 +// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
251 +type ProfilingOnlyFiberRootProperties = {|
252 + interactionThreadID: number,
253 + memoizedInteractions: Set<Interaction>,
254 + pendingInteractionMap: PendingInteractionMap,
255 +|};
256 +
257 +export type SuspenseHydrationCallbacks = {
258 + onHydrated?: (suspenseInstance: SuspenseInstance) => void,
259 + onDeleted?: (suspenseInstance: SuspenseInstance) => void,
260 + ...
261 +};
262 +
263 +// The follow fields are only used by enableSuspenseCallback for hydration.
264 +type SuspenseCallbackOnlyFiberRootProperties = {|
265 + hydrationCallbacks: null | SuspenseHydrationCallbacks,
266 +|};
267 +
268 +// Exported FiberRoot type includes all properties,
269 +// To avoid requiring potentially error-prone :any casts throughout the project.
270 +// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
271 +// The types are defined separately within this file to ensure they stay in sync.
272 +// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
273 +export type FiberRoot = {
274 + ...BaseFiberRootProperties,
275 + ...ProfilingOnlyFiberRootProperties,
276 + ...SuspenseCallbackOnlyFiberRootProperties,
277 + ...
278 +};
279 +
280 +type BasicStateAction<S> = (S => S) | S;
281 +type Dispatch<A> = A => void;
282 +
283 +export type Dispatcher = {|
284 + readContext<T>(
285 + context: ReactContext<T>,
286 + observedBits: void | number | boolean,
287 + ): T,
288 + useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>],
289 + useReducer<S, I, A>(
290 + reducer: (S, A) => S,
291 + initialArg: I,
292 + init?: (I) => S,
293 + ): [S, Dispatch<A>],
294 + useContext<T>(
295 + context: ReactContext<T>,
296 + observedBits: void | number | boolean,
297 + ): T,
298 + useRef<T>(initialValue: T): {|current: T|},
299 + useEffect(
300 + create: () => (() => void) | void,
301 + deps: Array<mixed> | void | null,
302 + ): void,
303 + useLayoutEffect(
304 + create: () => (() => void) | void,
305 + deps: Array<mixed> | void | null,
306 + ): void,
307 + useCallback<T>(callback: T, deps: Array<mixed> | void | null): T,
308 + useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T,
309 + useImperativeHandle<T>(
310 + ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
311 + create: () => T,
312 + deps: Array<mixed> | void | null,
313 + ): void,
314 + useDebugValue<T>(value: T, formatterFn: ?(value: T) => mixed): void,
315 + useResponder<E, C>(
316 + responder: ReactEventResponder<E, C>,
317 + props: Object,
318 + ): ReactEventResponderListener<E, C>,
319 + useDeferredValue<T>(value: T, config: TimeoutConfig | void | null): T,
320 + useTransition(
321 + config: SuspenseConfig | void | null,
322 + ): [(() => void) => void, boolean],
323 + useMutableSource<Source, Snapshot>(
324 + source: MutableSource<Source>,
325 + getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>,
326 + subscribe: MutableSourceSubscribeFn<Source, Snapshot>,
327 + ): Snapshot,
328 + useEvent(event: ReactListenerEvent): ReactListenerMap,
329 + useOpaqueIdentifier(): OpaqueIDType | void,
330 +|};
packages/react-reconciler/src/ReactMutableSource.old.js
+3 -3
@@ -7,12 +7,12 @@
7 * @flow
8 */
9
10 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
11 -import type {FiberRoot} from './ReactFiberRoot.old';
10 +import type {ExpirationTime} from './ReactFiberExpirationTime';
11 +import type {FiberRoot} from './ReactInternalTypes';
12 import type {MutableSource, MutableSourceVersion} from 'shared/ReactTypes';
13
14 import {isPrimaryRenderer} from './ReactFiberHostConfig';
15 -import {NoWork} from './ReactFiberExpirationTime.old';
15 +import {NoWork} from './ReactFiberExpirationTime';
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
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 import {
13 enableProfilerTimer,
packages/react-reconciler/src/ReactStrictModeWarnings.old.js
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import type {Fiber} from './ReactFiber.old';
10 +import type {Fiber} from './ReactInternalTypes';
11
12 import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
13
packages/react-reconciler/src/ReactUpdateQueue.old.js
+6 -6
@@ -84,12 +84,12 @@
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.old';
88 -import type {ExpirationTime} from './ReactFiberExpirationTime.old';
89 -import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
90 -import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
87 +import type {Fiber} from './ReactInternalTypes';
88 +import type {ExpirationTime} from './ReactFiberExpirationTime';
89 +import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
90 +import type {ReactPriorityLevel} from './ReactInternalTypes';
91
92 -import {NoWork, Sync} from './ReactFiberExpirationTime.old';
92 +import {NoWork, Sync} from './ReactFiberExpirationTime';
93 import {
94 enterDisallowedContextReadInDEV,
95 exitDisallowedContextReadInDEV,
@@ -213,7 +213,7 @@ export function enqueueUpdate<State>(fiber: Fiber, update: Update<State>) {
213 return;
214 }
215
216 - const sharedQueue = updateQueue.shared;
216 + const sharedQueue: SharedQueue<State> = (updateQueue: any).shared;
217 const pending = sharedQueue.pending;
218 if (pending === null) {
219 // This is the first update. Create a circular list.
packages/react-reconciler/src/SchedulerWithReactIntegration.old.js
+2 -1
@@ -7,6 +7,8 @@
7 * @flow
8 */
9
10 +import type {ReactPriorityLevel} from './ReactInternalTypes';
11 +
12 // Intentionally not named imports because Rollup would use dynamic dispatch for
13 // CommonJS interop named imports.
14 import * as Scheduler from 'scheduler';
@@ -43,7 +45,6 @@ if (enableSchedulerTracing) {
45 );
46 }
47
46 -export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90;
48 export type SchedulerCallback = (isSync: boolean) => SchedulerCallback | null;
49
50 type SchedulerCallbackOptions = {timeout?: number, ...};
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.old';
11 +import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
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.old';
11 -import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
11 +import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
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.old';
10 +import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
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.old';
10 +import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
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.old';
10 +import type {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
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.old';
10 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
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.old';
21 +import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
22
23 type DeepDifferOptions = {|+unsafelyIgnoreFunctions?: boolean|};
24