Remove cycle between ReactFiberHooks and ReactInternalTypes (#20242)
Co-authored-by: Paul Doyle <pauldoyle22@gmail.com>
Paul Doyle committed
Nov 13, 2020 at 06:18 UTC
2fbcc98066667848a0eb103e7f0afa540cbb475b
3 files changed
+19
-35
packages/react-reconciler/src/ReactFiberHooks.new.js
+1
-17
@@ -13,7 +13,7 @@ import type {
13
MutableSourceSubscribeFn,
14
ReactContext,
15
} from 'shared/ReactTypes';
16
-import type {Fiber, Dispatcher} from './ReactInternalTypes';
16
+import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes';
17
import type {Lanes, Lane} from './ReactFiberLane';
18
import type {HookFlags} from './ReactHookEffectTags';
19
import type {ReactPriorityLevel} from './ReactInternalTypes';
@@ -118,22 +118,6 @@ type UpdateQueue<S, A> = {|
118
lastRenderedState: S | null,
119
|};
120
121
-export type HookType =
122
- | 'useState'
123
- | 'useReducer'
124
- | 'useContext'
125
- | 'useRef'
126
- | 'useEffect'
127
- | 'useLayoutEffect'
128
- | 'useCallback'
129
- | 'useMemo'
130
- | 'useImperativeHandle'
131
- | 'useDebugValue'
132
- | 'useDeferredValue'
133
- | 'useTransition'
134
- | 'useMutableSource'
135
- | 'useOpaqueIdentifier';
136
-
121
let didWarnAboutMismatchedHooksForComponent;
122
let didWarnAboutUseOpaqueIdentifier;
123
if (__DEV__) {
packages/react-reconciler/src/ReactFiberHooks.old.js
+1
-17
@@ -13,7 +13,7 @@ import type {
13
MutableSourceSubscribeFn,
14
ReactContext,
15
} from 'shared/ReactTypes';
16
-import type {Fiber, Dispatcher} from './ReactInternalTypes';
16
+import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes';
17
import type {Lanes, Lane} from './ReactFiberLane';
18
import type {HookFlags} from './ReactHookEffectTags';
19
import type {ReactPriorityLevel} from './ReactInternalTypes';
@@ -109,22 +109,6 @@ type UpdateQueue<S, A> = {|
109
lastRenderedState: S | null,
110
|};
111
112
-export type HookType =
113
- | 'useState'
114
- | 'useReducer'
115
- | 'useContext'
116
- | 'useRef'
117
- | 'useEffect'
118
- | 'useLayoutEffect'
119
- | 'useCallback'
120
- | 'useMemo'
121
- | 'useImperativeHandle'
122
- | 'useDebugValue'
123
- | 'useDeferredValue'
124
- | 'useTransition'
125
- | 'useMutableSource'
126
- | 'useOpaqueIdentifier';
127
-
112
let didWarnAboutMismatchedHooksForComponent;
113
let didWarnAboutUseOpaqueIdentifier;
114
if (__DEV__) {
packages/react-reconciler/src/ReactInternalTypes.js
+17
-1
@@ -21,12 +21,28 @@ import type {WorkTag} from './ReactWorkTags';
21
import type {TypeOfMode} from './ReactTypeOfMode';
22
import type {Flags} from './ReactFiberFlags';
23
import type {Lane, LanePriority, Lanes, LaneMap} from './ReactFiberLane';
24
-import type {HookType} from './ReactFiberHooks.old';
24
import type {RootTag} from './ReactRootTags';
25
import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
26
import type {Wakeable} from 'shared/ReactTypes';
27
import type {Interaction} from 'scheduler/src/Tracing';
28
29
+// Unwind Circular: moved from ReactFiberHooks.old
30
+export type HookType =
31
+ | 'useState'
32
+ | 'useReducer'
33
+ | 'useContext'
34
+ | 'useRef'
35
+ | 'useEffect'
36
+ | 'useLayoutEffect'
37
+ | 'useCallback'
38
+ | 'useMemo'
39
+ | 'useImperativeHandle'
40
+ | 'useDebugValue'
41
+ | 'useDeferredValue'
42
+ | 'useTransition'
43
+ | 'useMutableSource'
44
+ | 'useOpaqueIdentifier';
45
+
46
export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90;
47
48
export type ContextDependency<T> = {