Skip to content

Commit 2fbcc98

Browse files
Remove cycle between ReactFiberHooks and ReactInternalTypes (#20242)
Co-authored-by: Paul Doyle <pauldoyle22@gmail.com>
1 parent 504222d commit 2fbcc98

File tree

3 files changed

+19
-35
lines changed

3 files changed

+19
-35
lines changed

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

+1-17
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {
1313
MutableSourceSubscribeFn,
1414
ReactContext,
1515
} from 'shared/ReactTypes';
16-
import type {Fiber, Dispatcher} from './ReactInternalTypes';
16+
import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes';
1717
import type {Lanes, Lane} from './ReactFiberLane';
1818
import type {HookFlags} from './ReactHookEffectTags';
1919
import type {ReactPriorityLevel} from './ReactInternalTypes';
@@ -118,22 +118,6 @@ type UpdateQueue<S, A> = {|
118118
lastRenderedState: S | null,
119119
|};
120120

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-
137121
let didWarnAboutMismatchedHooksForComponent;
138122
let didWarnAboutUseOpaqueIdentifier;
139123
if (__DEV__) {

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

+1-17
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {
1313
MutableSourceSubscribeFn,
1414
ReactContext,
1515
} from 'shared/ReactTypes';
16-
import type {Fiber, Dispatcher} from './ReactInternalTypes';
16+
import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes';
1717
import type {Lanes, Lane} from './ReactFiberLane';
1818
import type {HookFlags} from './ReactHookEffectTags';
1919
import type {ReactPriorityLevel} from './ReactInternalTypes';
@@ -109,22 +109,6 @@ type UpdateQueue<S, A> = {|
109109
lastRenderedState: S | null,
110110
|};
111111

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-
128112
let didWarnAboutMismatchedHooksForComponent;
129113
let didWarnAboutUseOpaqueIdentifier;
130114
if (__DEV__) {

packages/react-reconciler/src/ReactInternalTypes.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,28 @@ import type {WorkTag} from './ReactWorkTags';
2121
import type {TypeOfMode} from './ReactTypeOfMode';
2222
import type {Flags} from './ReactFiberFlags';
2323
import type {Lane, LanePriority, Lanes, LaneMap} from './ReactFiberLane';
24-
import type {HookType} from './ReactFiberHooks.old';
2524
import type {RootTag} from './ReactRootTags';
2625
import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
2726
import type {Wakeable} from 'shared/ReactTypes';
2827
import type {Interaction} from 'scheduler/src/Tracing';
2928

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+
3046
export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90;
3147

3248
export type ContextDependency<T> = {

0 commit comments

Comments
 (0)