diff --git a/packages/react-reconciler/src/ReactFiberHotReloading.js b/packages/react-reconciler/src/ReactFiberHotReloading.js index 35fa032d21160..0d3fdca45ceff 100644 --- a/packages/react-reconciler/src/ReactFiberHotReloading.js +++ b/packages/react-reconciler/src/ReactFiberHotReloading.js @@ -7,16 +7,11 @@ * @flow */ -import {enableNewReconciler} from 'shared/ReactFeatureFlags'; +import type {Instance} from './ReactFiberHostConfig'; +import type {FiberRoot} from './ReactInternalTypes'; +import type {ReactNodeList} from 'shared/ReactTypes'; -export type { - Family, - RefreshUpdate, - SetRefreshHandler, - ScheduleRefresh, - ScheduleRoot, - FindHostInstancesForRefresh, -} from './ReactFiberHotReloading'; +import {enableNewReconciler} from 'shared/ReactFeatureFlags'; import { setRefreshHandler as setRefreshHandler_old, @@ -42,6 +37,27 @@ import { findHostInstancesForRefresh as findHostInstancesForRefresh_new, } from './ReactFiberHotReloading.new'; +export type Family = { + current: any, +}; + +export type RefreshUpdate = { + staleFamilies: Set, + updatedFamilies: Set, +}; + +// Resolves type to a family. +export type RefreshHandler = any => Family | void; + +// Used by React Refresh runtime through DevTools Global Hook. +export type SetRefreshHandler = (handler: RefreshHandler | null) => void; +export type ScheduleRefresh = (root: FiberRoot, update: RefreshUpdate) => void; +export type ScheduleRoot = (root: FiberRoot, element: ReactNodeList) => void; +export type FindHostInstancesForRefresh = ( + root: FiberRoot, + families: Array, +) => Set; + export const setRefreshHandler = enableNewReconciler ? setRefreshHandler_new : setRefreshHandler_old; diff --git a/packages/react-reconciler/src/ReactFiberHotReloading.new.js b/packages/react-reconciler/src/ReactFiberHotReloading.new.js index b40a020620e6f..4f289fe4195e4 100644 --- a/packages/react-reconciler/src/ReactFiberHotReloading.new.js +++ b/packages/react-reconciler/src/ReactFiberHotReloading.new.js @@ -10,11 +10,19 @@ /* eslint-disable react-internal/prod-error-codes */ import type {ReactElement} from 'shared/ReactElementType'; -import type {Fiber} from './ReactInternalTypes'; -import type {FiberRoot} from './ReactInternalTypes'; +import type {Fiber, FiberRoot} from './ReactInternalTypes'; import type {Instance} from './ReactFiberHostConfig'; import type {ReactNodeList} from 'shared/ReactTypes'; +import type { + Family, + FindHostInstancesForRefresh, + RefreshHandler, + RefreshUpdate, + ScheduleRefresh, + ScheduleRoot, +} from './ReactFiberHotReloading'; + import { flushSync, scheduleUpdateOnFiber, @@ -40,27 +48,6 @@ import { REACT_LAZY_TYPE, } from 'shared/ReactSymbols'; -export type Family = { - current: any, -}; - -export type RefreshUpdate = { - staleFamilies: Set, - updatedFamilies: Set, -}; - -// Resolves type to a family. -type RefreshHandler = any => Family | void; - -// Used by React Refresh runtime through DevTools Global Hook. -export type SetRefreshHandler = (handler: RefreshHandler | null) => void; -export type ScheduleRefresh = (root: FiberRoot, update: RefreshUpdate) => void; -export type ScheduleRoot = (root: FiberRoot, element: ReactNodeList) => void; -export type FindHostInstancesForRefresh = ( - root: FiberRoot, - families: Array, -) => Set; - let resolveFamily: RefreshHandler | null = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. let failedBoundaries: WeakSet | null = null; diff --git a/packages/react-reconciler/src/ReactFiberHotReloading.old.js b/packages/react-reconciler/src/ReactFiberHotReloading.old.js index 866b0a7578185..55f0f94cf8a44 100644 --- a/packages/react-reconciler/src/ReactFiberHotReloading.old.js +++ b/packages/react-reconciler/src/ReactFiberHotReloading.old.js @@ -10,11 +10,19 @@ /* eslint-disable react-internal/prod-error-codes */ import type {ReactElement} from 'shared/ReactElementType'; -import type {Fiber} from './ReactInternalTypes'; -import type {FiberRoot} from './ReactInternalTypes'; +import type {Fiber, FiberRoot} from './ReactInternalTypes'; import type {Instance} from './ReactFiberHostConfig'; import type {ReactNodeList} from 'shared/ReactTypes'; +import type { + Family, + FindHostInstancesForRefresh, + RefreshHandler, + RefreshUpdate, + ScheduleRefresh, + ScheduleRoot, +} from './ReactFiberHotReloading'; + import { flushSync, scheduleUpdateOnFiber, @@ -40,27 +48,6 @@ import { REACT_LAZY_TYPE, } from 'shared/ReactSymbols'; -export type Family = { - current: any, -}; - -export type RefreshUpdate = { - staleFamilies: Set, - updatedFamilies: Set, -}; - -// Resolves type to a family. -type RefreshHandler = any => Family | void; - -// Used by React Refresh runtime through DevTools Global Hook. -export type SetRefreshHandler = (handler: RefreshHandler | null) => void; -export type ScheduleRefresh = (root: FiberRoot, update: RefreshUpdate) => void; -export type ScheduleRoot = (root: FiberRoot, element: ReactNodeList) => void; -export type FindHostInstancesForRefresh = ( - root: FiberRoot, - families: Array, -) => Set; - let resolveFamily: RefreshHandler | null = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. let failedBoundaries: WeakSet | null = null;