From d127861fa28e0a8fb03ae191e6cecae0c8c58e1e Mon Sep 17 00:00:00 2001 From: Paul Doyle Date: Sun, 8 Nov 2020 22:38:55 -0800 Subject: [PATCH] Remove cycle between ReactFiberHooks and ReactInternalTypes --- .../src/ReactFiberHooks.new.js | 18 +----------------- .../src/ReactFiberHooks.old.js | 18 +----------------- .../react-reconciler/src/ReactInternalTypes.js | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 231b33e69bcf9..37b141839b972 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -13,7 +13,7 @@ import type { MutableSourceSubscribeFn, ReactContext, } from 'shared/ReactTypes'; -import type {Fiber, Dispatcher} from './ReactInternalTypes'; +import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes'; import type {Lanes, Lane} from './ReactFiberLane'; import type {HookFlags} from './ReactHookEffectTags'; import type {ReactPriorityLevel} from './ReactInternalTypes'; @@ -118,22 +118,6 @@ type UpdateQueue = {| lastRenderedState: S | null, |}; -export type HookType = - | 'useState' - | 'useReducer' - | 'useContext' - | 'useRef' - | 'useEffect' - | 'useLayoutEffect' - | 'useCallback' - | 'useMemo' - | 'useImperativeHandle' - | 'useDebugValue' - | 'useDeferredValue' - | 'useTransition' - | 'useMutableSource' - | 'useOpaqueIdentifier'; - let didWarnAboutMismatchedHooksForComponent; let didWarnAboutUseOpaqueIdentifier; if (__DEV__) { diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index ccd69abae6aab..98e5d709cd285 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -13,7 +13,7 @@ import type { MutableSourceSubscribeFn, ReactContext, } from 'shared/ReactTypes'; -import type {Fiber, Dispatcher} from './ReactInternalTypes'; +import type {Fiber, Dispatcher, HookType} from './ReactInternalTypes'; import type {Lanes, Lane} from './ReactFiberLane'; import type {HookFlags} from './ReactHookEffectTags'; import type {ReactPriorityLevel} from './ReactInternalTypes'; @@ -109,22 +109,6 @@ type UpdateQueue = {| lastRenderedState: S | null, |}; -export type HookType = - | 'useState' - | 'useReducer' - | 'useContext' - | 'useRef' - | 'useEffect' - | 'useLayoutEffect' - | 'useCallback' - | 'useMemo' - | 'useImperativeHandle' - | 'useDebugValue' - | 'useDeferredValue' - | 'useTransition' - | 'useMutableSource' - | 'useOpaqueIdentifier'; - let didWarnAboutMismatchedHooksForComponent; let didWarnAboutUseOpaqueIdentifier; if (__DEV__) { diff --git a/packages/react-reconciler/src/ReactInternalTypes.js b/packages/react-reconciler/src/ReactInternalTypes.js index cebc8725ccb61..f63495cdce655 100644 --- a/packages/react-reconciler/src/ReactInternalTypes.js +++ b/packages/react-reconciler/src/ReactInternalTypes.js @@ -21,12 +21,28 @@ import type {WorkTag} from './ReactWorkTags'; import type {TypeOfMode} from './ReactTypeOfMode'; import type {Flags} from './ReactFiberFlags'; import type {Lane, LanePriority, Lanes, LaneMap} from './ReactFiberLane'; -import type {HookType} from './ReactFiberHooks.old'; import type {RootTag} from './ReactRootTags'; import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig'; import type {Wakeable} from 'shared/ReactTypes'; import type {Interaction} from 'scheduler/src/Tracing'; +// Unwind Circular: moved from ReactFiberHooks.old +export type HookType = + | 'useState' + | 'useReducer' + | 'useContext' + | 'useRef' + | 'useEffect' + | 'useLayoutEffect' + | 'useCallback' + | 'useMemo' + | 'useImperativeHandle' + | 'useDebugValue' + | 'useDeferredValue' + | 'useTransition' + | 'useMutableSource' + | 'useOpaqueIdentifier'; + export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90; export type ContextDependency = {