mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Add .old prefix to reconciler modules
This commit is contained in:
parent
147bdef11b
commit
d686f3f16a
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {
|
||||
DispatchConfig,
|
||||
ReactSyntheticEvent,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {EventPriority} from 'shared/ReactTypes';
|
||||
import type {TopLevelType} from './TopLevelEventTypes';
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@ import type {
|
|||
ReactEventResponderListener,
|
||||
ReactScopeMethods,
|
||||
} from 'shared/ReactTypes';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
|
||||
|
||||
import type {Hook, TimeoutConfig} from 'react-reconciler/src/ReactFiberHooks';
|
||||
import type {Dispatcher as DispatcherType} from 'react-reconciler/src/ReactFiberHooks';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
|
||||
import type {
|
||||
Hook,
|
||||
TimeoutConfig,
|
||||
Dispatcher as DispatcherType,
|
||||
} from 'react-reconciler/src/ReactFiberHooks.old';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
|
||||
import {NoMode} from 'react-reconciler/src/ReactTypeOfMode';
|
||||
|
||||
import ErrorStackParser from 'error-stack-parser';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
import {getInternalReactConstants} from './renderer';
|
||||
import describeComponentFrame from './describeComponentFrame';
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {ReactRenderer} from './types';
|
||||
|
||||
const APPEND_STACK_TO_METHODS = ['error', 'trace', 'warn'];
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import {
|
|||
registerRenderer as registerRendererWithConsole,
|
||||
} from './console';
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {
|
||||
ChangeDescription,
|
||||
CommitDataBackend,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
import type {ReactContext} from 'shared/ReactTypes';
|
||||
import type {Source} from 'shared/ReactElementType';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {
|
||||
ComponentFilter,
|
||||
ElementType,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {
|
||||
Container,
|
||||
TextInstance,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type {RootTag} from 'react-reconciler/src/ReactRootTags';
|
|||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
// TODO: This type is shared between the reconciler and ReactDOM, but will
|
||||
// eventually be lifted out to the renderer.
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
|
||||
import {findHostInstanceWithNoPortals} from 'react-reconciler/src/ReactFiberReconciler';
|
||||
|
||||
export type RootType = {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
|
|||
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {ElementListenerMap} from '../events/DOMEventListenerMap';
|
||||
import type {EventSystemFlags} from './EventSystemFlags';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {PluginModule} from 'legacy-events/PluginModuleType';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import type {
|
|||
} from '../events/DOMEventListenerMap';
|
||||
import type {EventSystemFlags} from './EventSystemFlags';
|
||||
import type {EventPriority, ReactScopeMethods} from 'shared/ReactTypes';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {PluginModule} from 'legacy-events/PluginModuleType';
|
||||
import type {
|
||||
ReactSyntheticEvent,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import {
|
|||
flushDiscreteUpdatesIfNeeded,
|
||||
executeUserEventHandler,
|
||||
} from './ReactDOMUpdateBatching';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import {enableDeprecatedFlareAPI} from 'shared/ReactFeatureFlags';
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
|
||||
import type {EventPriority} from 'shared/ReactTypes';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
|
||||
import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
|
||||
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type {Container, SuspenseInstance} from '../client/ReactDOMHostConfig';
|
|||
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {ElementListenerMap} from '../events/DOMEventListenerMap';
|
||||
import type {EventSystemFlags} from './EventSystemFlags';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
|
||||
|
||||
import {
|
||||
enableDeprecatedFlareAPI,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import type {
|
|||
DOMTopLevelEventType,
|
||||
} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {PluginModule} from 'legacy-events/PluginModuleType';
|
||||
import type {EventSystemFlags} from './EventSystemFlags';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
|
||||
import {HostComponent} from 'react-reconciler/src/ReactWorkTags';
|
||||
|
|
@ -82,7 +82,7 @@ function accumulateEnterLeaveListenersForEvent(
|
|||
return;
|
||||
}
|
||||
const dispatchListeners = [];
|
||||
const dispatchInstances = [];
|
||||
const dispatchInstances: Array<Fiber | null> = [];
|
||||
const dispatchCurrentTargets = [];
|
||||
|
||||
let instance = target;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ export default function accumulateEventTargetListeners(
|
|||
currentTarget: EventTarget,
|
||||
): void {
|
||||
const dispatchListeners = [];
|
||||
const dispatchInstances = [];
|
||||
const dispatchInstances: Array<Fiber | null> = [];
|
||||
const dispatchCurrentTargets = [];
|
||||
|
||||
const eventTypeMap = eventTargetEventListenerStore.get(currentTarget);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {DOMTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ export default function accumulateTwoPhaseListeners(
|
|||
): void {
|
||||
const phasedRegistrationNames = event.dispatchConfig.phasedRegistrationNames;
|
||||
const dispatchListeners = [];
|
||||
const dispatchInstances = [];
|
||||
const dispatchInstances: Array<Fiber | null> = [];
|
||||
const dispatchCurrentTargets = [];
|
||||
|
||||
const {bubbled, captured} = phasedRegistrationNames;
|
||||
|
|
|
|||
2
packages/react-dom/src/events/getListener.js
vendored
2
packages/react-dom/src/events/getListener.js
vendored
|
|
@ -6,7 +6,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {Props} from '../client/ReactDOMHostConfig';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
import type {
|
||||
Dispatcher as DispatcherType,
|
||||
TimeoutConfig,
|
||||
} from 'react-reconciler/src/ReactFiberHooks';
|
||||
} from 'react-reconciler/src/ReactFiberHooks.old';
|
||||
import type {ThreadID} from './ReactThreadIDAllocator';
|
||||
import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ import type {
|
|||
ReactContext,
|
||||
ReactEventResponderListener,
|
||||
} from 'shared/ReactTypes';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
|
||||
import type {ReactDOMListenerMap} from '../shared/ReactDOMTypes';
|
||||
|
||||
import {validateContextBounds} from './ReactPartialRendererContext';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {PluginModule} from 'legacy-events/PluginModuleType';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import type {AnyNativeEvent} from 'legacy-events/PluginModuleType';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {PluginModule} from 'legacy-events/PluginModuleType';
|
||||
import type {ReactSyntheticEvent} from 'legacy-events/ReactSyntheticEventType';
|
||||
import type {TopLevelType} from 'legacy-events/TopLevelEventTypes';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {TouchedViewDataAtPoint, InspectorData} from './ReactNativeTypes';
|
||||
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
import {getFiberCurrentPropsFromNode} from 'legacy-events/EventPluginUtils';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* environment.
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {UpdateQueue} from 'react-reconciler/src/ReactUpdateQueue';
|
||||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
import type {RootTag} from 'react-reconciler/src/ReactRootTags';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import type {ReactElement} from 'shared/ReactElementType';
|
|||
import type {ReactPortal} from 'shared/ReactTypes';
|
||||
import type {BlockComponent} from 'react/src/ReactBlock';
|
||||
import type {LazyComponent} from 'react/src/ReactLazy';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import {Placement, Deletion} from './ReactSideEffectTags';
|
||||
|
|
@ -42,11 +42,11 @@ import {
|
|||
createFiberFromFragment,
|
||||
createFiberFromText,
|
||||
createFiberFromPortal,
|
||||
} from './ReactFiber';
|
||||
import {emptyRefsObject} from './ReactFiberClassComponent';
|
||||
} from './ReactFiber.old';
|
||||
import {emptyRefsObject} from './ReactFiberClassComponent.old';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
import {getCurrentFiberStackInDev} from './ReactCurrentFiber';
|
||||
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading';
|
||||
import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.old';
|
||||
import {StrictMode} from './ReactTypeOfMode';
|
||||
|
||||
let didWarnAboutMaps;
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ import type {
|
|||
ReactFundamentalComponent,
|
||||
ReactScope,
|
||||
} from 'shared/ReactTypes';
|
||||
import type {RootTag} from 'react-reconciler/src/ReactRootTags';
|
||||
import type {RootTag} from './ReactRootTags';
|
||||
import type {WorkTag} from './ReactWorkTags';
|
||||
import type {TypeOfMode} from './ReactTypeOfMode';
|
||||
import type {SideEffectTag} from './ReactSideEffectTags';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {UpdateQueue} from './ReactUpdateQueue';
|
||||
import type {ContextDependency} from './ReactFiberNewContext';
|
||||
import type {HookType} from './ReactFiberHooks';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {UpdateQueue} from './ReactUpdateQueue.old';
|
||||
import type {ContextDependency} from './ReactFiberNewContext.old';
|
||||
import type {HookType} from './ReactFiberHooks.old';
|
||||
import type {SuspenseInstance} from './ReactFiberHostConfig';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
|
|
@ -36,7 +36,7 @@ import {
|
|||
throwEarlyForMysteriousError,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {NoEffect, Placement} from './ReactSideEffectTags';
|
||||
import {ConcurrentRoot, BlockingRoot} from 'react-reconciler/src/ReactRootTags';
|
||||
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
|
||||
import {
|
||||
IndeterminateComponent,
|
||||
ClassComponent,
|
||||
|
|
@ -63,13 +63,13 @@ import {
|
|||
} from './ReactWorkTags';
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
|
||||
import {isDevToolsPresent} from './ReactFiberDevToolsHook';
|
||||
import {isDevToolsPresent} from './ReactFiberDevToolsHook.old';
|
||||
import {
|
||||
resolveClassForHotReloading,
|
||||
resolveFunctionForHotReloading,
|
||||
resolveForwardRefForHotReloading,
|
||||
} from './ReactFiberHotReloading';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
} from './ReactFiberHotReloading.old';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
NoMode,
|
||||
ConcurrentMode,
|
||||
|
|
@ -10,15 +10,15 @@
|
|||
import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
|
||||
import type {BlockComponent} from 'react/src/ReactBlock';
|
||||
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {
|
||||
SuspenseState,
|
||||
SuspenseListRenderState,
|
||||
SuspenseListTailMode,
|
||||
} from './ReactFiberSuspenseComponent';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext';
|
||||
} from './ReactFiberSuspenseComponent.old';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
|
||||
|
||||
import checkPropTypes from 'shared/checkPropTypes';
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ import {
|
|||
import invariant from 'shared/invariant';
|
||||
import shallowEqual from 'shared/shallowEqual';
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
|
||||
import {REACT_LAZY_TYPE, getIteratorFn} from 'shared/ReactSymbols';
|
||||
import {
|
||||
getCurrentFiberOwnerNameInDevOrNull,
|
||||
|
|
@ -83,24 +83,24 @@ import {
|
|||
resolveFunctionForHotReloading,
|
||||
resolveForwardRefForHotReloading,
|
||||
resolveClassForHotReloading,
|
||||
} from './ReactFiberHotReloading';
|
||||
} from './ReactFiberHotReloading.old';
|
||||
|
||||
import {
|
||||
mountChildFibers,
|
||||
reconcileChildFibers,
|
||||
cloneChildFibers,
|
||||
} from './ReactChildFiber';
|
||||
} from './ReactChildFiber.old';
|
||||
import {
|
||||
processUpdateQueue,
|
||||
cloneUpdateQueue,
|
||||
initializeUpdateQueue,
|
||||
} from './ReactUpdateQueue';
|
||||
} from './ReactUpdateQueue.old';
|
||||
import {
|
||||
NoWork,
|
||||
Never,
|
||||
Sync,
|
||||
computeAsyncExpiration,
|
||||
} from './ReactFiberExpirationTime';
|
||||
} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
ConcurrentMode,
|
||||
NoMode,
|
||||
|
|
@ -117,7 +117,7 @@ import {
|
|||
} from './ReactFiberHostConfig';
|
||||
import type {SuspenseInstance} from './ReactFiberHostConfig';
|
||||
import {shouldSuspend} from './ReactFiberReconciler';
|
||||
import {pushHostContext, pushHostContainer} from './ReactFiberHostContext';
|
||||
import {pushHostContext, pushHostContainer} from './ReactFiberHostContext.old';
|
||||
import {
|
||||
suspenseStackCursor,
|
||||
pushSuspenseContext,
|
||||
|
|
@ -127,8 +127,8 @@ import {
|
|||
setDefaultShallowSuspenseContext,
|
||||
addSubtreeSuspenseContext,
|
||||
setShallowSuspenseContext,
|
||||
} from './ReactFiberSuspenseContext';
|
||||
import {findFirstSuspended} from './ReactFiberSuspenseComponent';
|
||||
} from './ReactFiberSuspenseContext.old';
|
||||
import {findFirstSuspended} from './ReactFiberSuspenseComponent.old';
|
||||
import {
|
||||
pushProvider,
|
||||
propagateContextChange,
|
||||
|
|
@ -136,9 +136,9 @@ import {
|
|||
prepareToReadContext,
|
||||
calculateChangedBits,
|
||||
scheduleWorkOnParentPath,
|
||||
} from './ReactFiberNewContext';
|
||||
import {renderWithHooks, bailoutHooks} from './ReactFiberHooks';
|
||||
import {stopProfilerTimerIfRunning} from './ReactProfilerTimer';
|
||||
} from './ReactFiberNewContext.old';
|
||||
import {renderWithHooks, bailoutHooks} from './ReactFiberHooks.old';
|
||||
import {stopProfilerTimerIfRunning} from './ReactProfilerTimer.old';
|
||||
import {
|
||||
getMaskedContext,
|
||||
getUnmaskedContext,
|
||||
|
|
@ -147,14 +147,14 @@ import {
|
|||
isContextProvider as isLegacyContextProvider,
|
||||
pushTopLevelContextObject,
|
||||
invalidateContextProvider,
|
||||
} from './ReactFiberContext';
|
||||
} from './ReactFiberContext.old';
|
||||
import {
|
||||
enterHydrationState,
|
||||
reenterHydrationStateFromDehydratedSuspenseInstance,
|
||||
resetHydrationState,
|
||||
tryToClaimNextHydratableInstance,
|
||||
warnIfHydrating,
|
||||
} from './ReactFiberHydrationContext';
|
||||
} from './ReactFiberHydrationContext.old';
|
||||
import {
|
||||
adoptClassInstance,
|
||||
applyDerivedStateFromProps,
|
||||
|
|
@ -162,15 +162,15 @@ import {
|
|||
mountClassInstance,
|
||||
resumeMountClassInstance,
|
||||
updateClassInstance,
|
||||
} from './ReactFiberClassComponent';
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent';
|
||||
} from './ReactFiberClassComponent.old';
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
|
||||
import {
|
||||
resolveLazyComponentTag,
|
||||
createFiberFromTypeAndProps,
|
||||
createFiberFromFragment,
|
||||
createWorkInProgress,
|
||||
isSimpleFunctionComponent,
|
||||
} from './ReactFiber';
|
||||
} from './ReactFiber.old';
|
||||
import {
|
||||
markSpawnedWork,
|
||||
requestCurrentTimeForUpdate,
|
||||
|
|
@ -179,7 +179,7 @@ import {
|
|||
renderDidSuspendDelayIfPossible,
|
||||
markUnprocessedUpdateTime,
|
||||
getWorkInProgressRoot,
|
||||
} from './ReactFiberWorkLoop';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {UpdateQueue} from './ReactUpdateQueue';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {UpdateQueue} from './ReactUpdateQueue.old';
|
||||
|
||||
import * as React from 'react';
|
||||
import {Update, Snapshot} from './ReactSideEffectTags';
|
||||
|
|
@ -18,15 +18,15 @@ import {
|
|||
disableLegacyContext,
|
||||
warnAboutDeprecatedLifecycles,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings';
|
||||
import {isMounted} from 'react-reconciler/src/ReactFiberTreeReflection';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
|
||||
import {isMounted} from './ReactFiberTreeReflection';
|
||||
import {get as getInstance, set as setInstance} from 'shared/ReactInstanceMap';
|
||||
import shallowEqual from 'shared/shallowEqual';
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import invariant from 'shared/invariant';
|
||||
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
|
||||
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent';
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
|
||||
import {StrictMode} from './ReactTypeOfMode';
|
||||
|
||||
import {
|
||||
|
|
@ -39,22 +39,22 @@ import {
|
|||
ForceUpdate,
|
||||
initializeUpdateQueue,
|
||||
cloneUpdateQueue,
|
||||
} from './ReactUpdateQueue';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
} from './ReactUpdateQueue.old';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
cacheContext,
|
||||
getMaskedContext,
|
||||
getUnmaskedContext,
|
||||
hasContextChanged,
|
||||
emptyContextObject,
|
||||
} from './ReactFiberContext';
|
||||
import {readContext} from './ReactFiberNewContext';
|
||||
} from './ReactFiberContext.old';
|
||||
import {readContext} from './ReactFiberNewContext.old';
|
||||
import {
|
||||
requestCurrentTimeForUpdate,
|
||||
computeExpirationForFiber,
|
||||
scheduleUpdateOnFiber,
|
||||
} from './ReactFiberWorkLoop';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
|
||||
|
|
@ -15,13 +15,13 @@ import type {
|
|||
ChildSet,
|
||||
UpdatePayload,
|
||||
} from './ReactFiberHostConfig';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent';
|
||||
import type {FunctionComponentUpdateQueue} from './ReactFiberHooks';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
|
||||
import type {FunctionComponentUpdateQueue} from './ReactFiberHooks.old';
|
||||
import type {Wakeable} from 'shared/ReactTypes';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {unstable_wrap as Schedule_tracing_wrap} from 'scheduler/tracing';
|
||||
import {
|
||||
|
|
@ -72,18 +72,18 @@ import {
|
|||
import getComponentName from 'shared/getComponentName';
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
import {onCommitUnmount} from './ReactFiberDevToolsHook';
|
||||
import {onCommitUnmount} from './ReactFiberDevToolsHook.old';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent';
|
||||
import {resolveDefaultProps} from './ReactFiberLazyComponent.old';
|
||||
import {
|
||||
getCommitTime,
|
||||
recordLayoutEffectDuration,
|
||||
recordPassiveEffectDuration,
|
||||
startLayoutEffectTimer,
|
||||
startPassiveEffectTimer,
|
||||
} from './ReactProfilerTimer';
|
||||
} from './ReactProfilerTimer.old';
|
||||
import {ProfileMode} from './ReactTypeOfMode';
|
||||
import {commitUpdateQueue} from './ReactUpdateQueue';
|
||||
import {commitUpdateQueue} from './ReactUpdateQueue.old';
|
||||
import {
|
||||
getPublicInstance,
|
||||
supportsMutation,
|
||||
|
|
@ -120,19 +120,22 @@ import {
|
|||
enqueuePendingPassiveHookEffectMount,
|
||||
enqueuePendingPassiveHookEffectUnmount,
|
||||
enqueuePendingPassiveProfilerEffect,
|
||||
} from './ReactFiberWorkLoop';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {
|
||||
NoEffect as NoHookEffect,
|
||||
HasEffect as HookHasEffect,
|
||||
Layout as HookLayout,
|
||||
Passive as HookPassive,
|
||||
} from './ReactHookEffectTags';
|
||||
import {didWarnAboutReassigningProps} from './ReactFiberBeginWork';
|
||||
import {runWithPriority, NormalPriority} from './SchedulerWithReactIntegration';
|
||||
import {didWarnAboutReassigningProps} from './ReactFiberBeginWork.old';
|
||||
import {
|
||||
runWithPriority,
|
||||
NormalPriority,
|
||||
} from './SchedulerWithReactIntegration.old';
|
||||
import {
|
||||
updateDeprecatedEventListeners,
|
||||
unmountDeprecatedResponderListeners,
|
||||
} from './ReactFiberDeprecatedEvents';
|
||||
} from './ReactFiberDeprecatedEvents.old';
|
||||
|
||||
let didWarnAboutUndefinedSnapshotBeforeUpdate: Set<mixed> | null = null;
|
||||
if (__DEV__) {
|
||||
|
|
@ -7,13 +7,13 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {
|
||||
ReactFundamentalComponentInstance,
|
||||
ReactScopeInstance,
|
||||
} from 'shared/ReactTypes';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {
|
||||
Instance,
|
||||
Type,
|
||||
|
|
@ -24,11 +24,11 @@ import type {
|
|||
import type {
|
||||
SuspenseState,
|
||||
SuspenseListRenderState,
|
||||
} from './ReactFiberSuspenseComponent';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext';
|
||||
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource';
|
||||
} from './ReactFiberSuspenseComponent.old';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
|
||||
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
|
||||
|
||||
import {now} from './SchedulerWithReactIntegration';
|
||||
import {now} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {
|
||||
IndeterminateComponent,
|
||||
|
|
@ -88,7 +88,7 @@ import {
|
|||
popHostContext,
|
||||
getHostContext,
|
||||
popHostContainer,
|
||||
} from './ReactFiberHostContext';
|
||||
} from './ReactFiberHostContext.old';
|
||||
import {
|
||||
suspenseStackCursor,
|
||||
InvisibleParentSuspenseContext,
|
||||
|
|
@ -98,21 +98,21 @@ import {
|
|||
setShallowSuspenseContext,
|
||||
ForceSuspenseFallback,
|
||||
setDefaultShallowSuspenseContext,
|
||||
} from './ReactFiberSuspenseContext';
|
||||
import {findFirstSuspended} from './ReactFiberSuspenseComponent';
|
||||
} from './ReactFiberSuspenseContext.old';
|
||||
import {findFirstSuspended} from './ReactFiberSuspenseComponent.old';
|
||||
import {
|
||||
isContextProvider as isLegacyContextProvider,
|
||||
popContext as popLegacyContext,
|
||||
popTopLevelContextObject as popTopLevelLegacyContextObject,
|
||||
} from './ReactFiberContext';
|
||||
import {popProvider} from './ReactFiberNewContext';
|
||||
} from './ReactFiberContext.old';
|
||||
import {popProvider} from './ReactFiberNewContext.old';
|
||||
import {
|
||||
prepareToHydrateHostInstance,
|
||||
prepareToHydrateHostTextInstance,
|
||||
prepareToHydrateHostSuspenseInstance,
|
||||
popHydrationState,
|
||||
resetHydrationState,
|
||||
} from './ReactFiberHydrationContext';
|
||||
} from './ReactFiberHydrationContext.old';
|
||||
import {
|
||||
enableSchedulerTracing,
|
||||
enableSuspenseCallback,
|
||||
|
|
@ -127,12 +127,12 @@ import {
|
|||
renderDidSuspend,
|
||||
renderDidSuspendDelayIfPossible,
|
||||
renderHasNotSuspendedYet,
|
||||
} from './ReactFiberWorkLoop';
|
||||
import {createFundamentalStateInstance} from './ReactFiberFundamental';
|
||||
import {Never} from './ReactFiberExpirationTime';
|
||||
import {resetChildFibers} from './ReactChildFiber';
|
||||
import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents';
|
||||
import {createScopeMethods} from './ReactFiberScope';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {createFundamentalStateInstance} from './ReactFiberFundamental.old';
|
||||
import {Never} from './ReactFiberExpirationTime.old';
|
||||
import {resetChildFibers} from './ReactChildFiber.old';
|
||||
import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents.old';
|
||||
import {createScopeMethods} from './ReactFiberScope.old';
|
||||
|
||||
function markUpdate(workInProgress: Fiber) {
|
||||
// Tag the fiber with an update effect. This turns a Placement into
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
import {
|
||||
HostComponent,
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {StackCursor} from './ReactFiberStack';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {StackCursor} from './ReactFiberStack.old';
|
||||
|
||||
import {isFiberMounted} from 'react-reconciler/src/ReactFiberTreeReflection';
|
||||
import {isFiberMounted} from './ReactFiberTreeReflection';
|
||||
import {disableLegacyContext} from 'shared/ReactFeatureFlags';
|
||||
import {ClassComponent, HostRoot} from './ReactWorkTags';
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import invariant from 'shared/invariant';
|
||||
import checkPropTypes from 'shared/checkPropTypes';
|
||||
|
||||
import {createCursor, push, pop} from './ReactFiberStack';
|
||||
import {createCursor, push, pop} from './ReactFiberStack.old';
|
||||
|
||||
let warnedAboutMissingGetChildContext;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {Container, Instance} from './ReactFiberHostConfig';
|
||||
import type {
|
||||
ReactEventResponder,
|
||||
|
|
@ -19,7 +19,7 @@ import {
|
|||
DEPRECATED_mountResponderInstance,
|
||||
DEPRECATED_unmountResponderInstance,
|
||||
} from './ReactFiberHostConfig';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
|
||||
import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
|
||||
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
*/
|
||||
|
||||
import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
|
||||
import {getCurrentTime} from './ReactFiberWorkLoop';
|
||||
import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime';
|
||||
import {getCurrentTime} from './ReactFiberWorkLoop.old';
|
||||
import {inferPriorityFromExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
|
||||
import {DidCapture} from './ReactSideEffectTags';
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {CapturedValue} from './ReactCapturedValue';
|
||||
|
||||
// This module is forked in different environments.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {CapturedValue} from './ReactCapturedValue';
|
||||
|
||||
import {showErrorDialog} from './ReactFiberErrorDialog';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import {
|
|||
UserBlockingPriority,
|
||||
NormalPriority,
|
||||
IdlePriority,
|
||||
} from './SchedulerWithReactIntegration';
|
||||
} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
export type ExpirationTime = number;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {
|
||||
ReactFundamentalImpl,
|
||||
ReactFundamentalComponentInstance,
|
||||
|
|
@ -16,12 +16,12 @@ import type {
|
|||
ReactEventResponderListener,
|
||||
ReactScopeMethods,
|
||||
} from 'shared/ReactTypes';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {HookEffectTag} from './ReactHookEffectTags';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {
|
||||
OpaqueIDType,
|
||||
ReactListenerEvent,
|
||||
|
|
@ -32,11 +32,11 @@ import type {
|
|||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||
import {enableUseEventAPI} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {markRootExpiredAtTime} from './ReactFiberRoot';
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime';
|
||||
import {markRootExpiredAtTime} from './ReactFiberRoot.old';
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime.old';
|
||||
import {NoMode, BlockingMode} from './ReactTypeOfMode';
|
||||
import {readContext} from './ReactFiberNewContext';
|
||||
import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents';
|
||||
import {readContext} from './ReactFiberNewContext.old';
|
||||
import {createDeprecatedResponderListener} from './ReactFiberDeprecatedEvents.old';
|
||||
import {
|
||||
Update as UpdateEffect,
|
||||
Passive as PassiveEffect,
|
||||
|
|
@ -57,7 +57,7 @@ import {
|
|||
warnIfNotScopedWithMatchingAct,
|
||||
markRenderEventTimeAndConfig,
|
||||
markUnprocessedUpdateTime,
|
||||
} from './ReactFiberWorkLoop';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {
|
||||
registerEvent,
|
||||
mountEventListener as mountHostEventListener,
|
||||
|
|
@ -68,15 +68,15 @@ import {
|
|||
import invariant from 'shared/invariant';
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import is from 'shared/objectIs';
|
||||
import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
import {
|
||||
UserBlockingPriority,
|
||||
NormalPriority,
|
||||
runWithPriority,
|
||||
getCurrentPriorityLevel,
|
||||
} from './SchedulerWithReactIntegration';
|
||||
import {getIsHydrating} from './ReactFiberHydrationContext';
|
||||
} from './SchedulerWithReactIntegration.old';
|
||||
import {getIsHydrating} from './ReactFiberHydrationContext.old';
|
||||
import {
|
||||
makeClientId,
|
||||
makeClientIdInDEV,
|
||||
|
|
@ -89,8 +89,8 @@ import {
|
|||
setPendingExpirationTime,
|
||||
setWorkInProgressVersion,
|
||||
warnAboutMultipleRenderersDEV,
|
||||
} from './ReactMutableSource';
|
||||
import {getRootHostContainer} from './ReactFiberHostContext';
|
||||
} from './ReactMutableSource.old';
|
||||
import {getRootHostContainer} from './ReactFiberHostContext.old';
|
||||
import {getIsRendering} from './ReactCurrentFiber';
|
||||
|
||||
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
|
||||
|
|
@ -7,14 +7,14 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {StackCursor} from './ReactFiberStack';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {StackCursor} from './ReactFiberStack.old';
|
||||
import type {Container, HostContext} from './ReactFiberHostConfig';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
import {getChildHostContext, getRootHostContext} from './ReactFiberHostConfig';
|
||||
import {createCursor, push, pop} from './ReactFiberStack';
|
||||
import {createCursor, push, pop} from './ReactFiberStack.old';
|
||||
|
||||
declare class NoContextT {}
|
||||
const NO_CONTEXT: NoContextT = ({}: any);
|
||||
|
|
@ -7,476 +7,66 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {ReactElement} from 'shared/ReactElementType';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {Instance} from './ReactFiberHostConfig';
|
||||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
import {enableNewReconciler} from 'shared/ReactFeatureFlags';
|
||||
|
||||
export type {
|
||||
Family,
|
||||
RefreshUpdate,
|
||||
SetRefreshHandler,
|
||||
ScheduleRefresh,
|
||||
ScheduleRoot,
|
||||
FindHostInstancesForRefresh,
|
||||
} from './ReactFiberHotReloading';
|
||||
|
||||
import {
|
||||
flushSync,
|
||||
scheduleUpdateOnFiber,
|
||||
flushPassiveEffects,
|
||||
} from './ReactFiberWorkLoop';
|
||||
import {updateContainer, syncUpdates} from './ReactFiberReconciler';
|
||||
import {emptyContextObject} from './ReactFiberContext';
|
||||
import {Sync} from './ReactFiberExpirationTime';
|
||||
setRefreshHandler as setRefreshHandler_old,
|
||||
resolveFunctionForHotReloading as resolveFunctionForHotReloading_old,
|
||||
resolveClassForHotReloading as resolveClassForHotReloading_old,
|
||||
resolveForwardRefForHotReloading as resolveForwardRefForHotReloading_old,
|
||||
isCompatibleFamilyForHotReloading as isCompatibleFamilyForHotReloading_old,
|
||||
markFailedErrorBoundaryForHotReloading as markFailedErrorBoundaryForHotReloading_old,
|
||||
scheduleRefresh as scheduleRefresh_old,
|
||||
scheduleRoot as scheduleRoot_old,
|
||||
findHostInstancesForRefresh as findHostInstancesForRefresh_old,
|
||||
} from './ReactFiberHotReloading.old';
|
||||
|
||||
// TODO: Update these to point to the fork.
|
||||
import {
|
||||
ClassComponent,
|
||||
FunctionComponent,
|
||||
ForwardRef,
|
||||
HostComponent,
|
||||
HostPortal,
|
||||
HostRoot,
|
||||
MemoComponent,
|
||||
SimpleMemoComponent,
|
||||
} from './ReactWorkTags';
|
||||
import {
|
||||
REACT_FORWARD_REF_TYPE,
|
||||
REACT_MEMO_TYPE,
|
||||
REACT_LAZY_TYPE,
|
||||
} from 'shared/ReactSymbols';
|
||||
setRefreshHandler as setRefreshHandler_new,
|
||||
resolveFunctionForHotReloading as resolveFunctionForHotReloading_new,
|
||||
resolveClassForHotReloading as resolveClassForHotReloading_new,
|
||||
resolveForwardRefForHotReloading as resolveForwardRefForHotReloading_new,
|
||||
isCompatibleFamilyForHotReloading as isCompatibleFamilyForHotReloading_new,
|
||||
markFailedErrorBoundaryForHotReloading as markFailedErrorBoundaryForHotReloading_new,
|
||||
scheduleRefresh as scheduleRefresh_new,
|
||||
scheduleRoot as scheduleRoot_new,
|
||||
findHostInstancesForRefresh as findHostInstancesForRefresh_new,
|
||||
} from './ReactFiberHotReloading.old';
|
||||
|
||||
export type Family = {|
|
||||
current: any,
|
||||
|};
|
||||
|
||||
export type RefreshUpdate = {|
|
||||
staleFamilies: Set<Family>,
|
||||
updatedFamilies: Set<Family>,
|
||||
|};
|
||||
|
||||
// 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<Family>,
|
||||
) => Set<Instance>;
|
||||
|
||||
let resolveFamily: RefreshHandler | null = null;
|
||||
// $FlowFixMe Flow gets confused by a WeakSet feature check below.
|
||||
let failedBoundaries: WeakSet<Fiber> | null = null;
|
||||
|
||||
export const setRefreshHandler = (handler: RefreshHandler | null): void => {
|
||||
if (__DEV__) {
|
||||
resolveFamily = handler;
|
||||
}
|
||||
};
|
||||
|
||||
export function resolveFunctionForHotReloading(type: any): any {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return type;
|
||||
}
|
||||
const family = resolveFamily(type);
|
||||
if (family === undefined) {
|
||||
return type;
|
||||
}
|
||||
// Use the latest known implementation.
|
||||
return family.current;
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveClassForHotReloading(type: any): any {
|
||||
// No implementation differences.
|
||||
return resolveFunctionForHotReloading(type);
|
||||
}
|
||||
|
||||
export function resolveForwardRefForHotReloading(type: any): any {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return type;
|
||||
}
|
||||
const family = resolveFamily(type);
|
||||
if (family === undefined) {
|
||||
// Check if we're dealing with a real forwardRef. Don't want to crash early.
|
||||
if (
|
||||
type !== null &&
|
||||
type !== undefined &&
|
||||
typeof type.render === 'function'
|
||||
) {
|
||||
// ForwardRef is special because its resolved .type is an object,
|
||||
// but it's possible that we only have its inner render function in the map.
|
||||
// If that inner render function is different, we'll build a new forwardRef type.
|
||||
const currentRender = resolveFunctionForHotReloading(type.render);
|
||||
if (type.render !== currentRender) {
|
||||
const syntheticType = {
|
||||
$$typeof: REACT_FORWARD_REF_TYPE,
|
||||
render: currentRender,
|
||||
};
|
||||
if (type.displayName !== undefined) {
|
||||
(syntheticType: any).displayName = type.displayName;
|
||||
}
|
||||
return syntheticType;
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
// Use the latest known implementation.
|
||||
return family.current;
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
export function isCompatibleFamilyForHotReloading(
|
||||
fiber: Fiber,
|
||||
element: ReactElement,
|
||||
): boolean {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return false;
|
||||
}
|
||||
|
||||
const prevType = fiber.elementType;
|
||||
const nextType = element.type;
|
||||
|
||||
// If we got here, we know types aren't === equal.
|
||||
let needsCompareFamilies = false;
|
||||
|
||||
const $$typeofNextType =
|
||||
typeof nextType === 'object' && nextType !== null
|
||||
? nextType.$$typeof
|
||||
: null;
|
||||
|
||||
switch (fiber.tag) {
|
||||
case ClassComponent: {
|
||||
if (typeof nextType === 'function') {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FunctionComponent: {
|
||||
if (typeof nextType === 'function') {
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
// We don't know the inner type yet.
|
||||
// We're going to assume that the lazy inner type is stable,
|
||||
// and so it is sufficient to avoid reconciling it away.
|
||||
// We're not going to unwrap or actually use the new lazy type.
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ForwardRef: {
|
||||
if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MemoComponent:
|
||||
case SimpleMemoComponent: {
|
||||
if ($$typeofNextType === REACT_MEMO_TYPE) {
|
||||
// TODO: if it was but can no longer be simple,
|
||||
// we shouldn't set this.
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if both types have a family and it's the same one.
|
||||
if (needsCompareFamilies) {
|
||||
// Note: memo() and forwardRef() we'll compare outer rather than inner type.
|
||||
// This means both of them need to be registered to preserve state.
|
||||
// If we unwrapped and compared the inner types for wrappers instead,
|
||||
// then we would risk falsely saying two separate memo(Foo)
|
||||
// calls are equivalent because they wrap the same Foo function.
|
||||
const prevFamily = resolveFamily(prevType);
|
||||
if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return;
|
||||
}
|
||||
if (typeof WeakSet !== 'function') {
|
||||
return;
|
||||
}
|
||||
if (failedBoundaries === null) {
|
||||
failedBoundaries = new WeakSet();
|
||||
}
|
||||
failedBoundaries.add(fiber);
|
||||
}
|
||||
}
|
||||
|
||||
export const scheduleRefresh: ScheduleRefresh = (
|
||||
root: FiberRoot,
|
||||
update: RefreshUpdate,
|
||||
): void => {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return;
|
||||
}
|
||||
const {staleFamilies, updatedFamilies} = update;
|
||||
flushPassiveEffects();
|
||||
flushSync(() => {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
root.current,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const scheduleRoot: ScheduleRoot = (
|
||||
root: FiberRoot,
|
||||
element: ReactNodeList,
|
||||
): void => {
|
||||
if (__DEV__) {
|
||||
if (root.context !== emptyContextObject) {
|
||||
// Super edge case: root has a legacy _renderSubtree context
|
||||
// but we don't know the parentComponent so we can't pass it.
|
||||
// Just ignore. We'll delete this with _renderSubtree code path later.
|
||||
return;
|
||||
}
|
||||
flushPassiveEffects();
|
||||
syncUpdates(() => {
|
||||
updateContainer(element, root, null, null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function scheduleFibersWithFamiliesRecursively(
|
||||
fiber: Fiber,
|
||||
updatedFamilies: Set<Family>,
|
||||
staleFamilies: Set<Family>,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
const {alternate, child, sibling, tag, type} = fiber;
|
||||
|
||||
let candidateType = null;
|
||||
switch (tag) {
|
||||
case FunctionComponent:
|
||||
case SimpleMemoComponent:
|
||||
case ClassComponent:
|
||||
candidateType = type;
|
||||
break;
|
||||
case ForwardRef:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (resolveFamily === null) {
|
||||
throw new Error('Expected resolveFamily to be set during hot reload.');
|
||||
}
|
||||
|
||||
let needsRender = false;
|
||||
let needsRemount = false;
|
||||
if (candidateType !== null) {
|
||||
const family = resolveFamily(candidateType);
|
||||
if (family !== undefined) {
|
||||
if (staleFamilies.has(family)) {
|
||||
needsRemount = true;
|
||||
} else if (updatedFamilies.has(family)) {
|
||||
if (tag === ClassComponent) {
|
||||
needsRemount = true;
|
||||
} else {
|
||||
needsRender = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failedBoundaries !== null) {
|
||||
if (
|
||||
failedBoundaries.has(fiber) ||
|
||||
(alternate !== null && failedBoundaries.has(alternate))
|
||||
) {
|
||||
needsRemount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needsRemount) {
|
||||
fiber._debugNeedsRemount = true;
|
||||
}
|
||||
if (needsRemount || needsRender) {
|
||||
scheduleUpdateOnFiber(fiber, Sync);
|
||||
}
|
||||
if (child !== null && !needsRemount) {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
child,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
}
|
||||
if (sibling !== null) {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
sibling,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const findHostInstancesForRefresh: FindHostInstancesForRefresh = (
|
||||
root: FiberRoot,
|
||||
families: Array<Family>,
|
||||
): Set<Instance> => {
|
||||
if (__DEV__) {
|
||||
const hostInstances = new Set();
|
||||
const types = new Set(families.map(family => family.current));
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
root.current,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
return hostInstances;
|
||||
} else {
|
||||
throw new Error(
|
||||
'Did not expect findHostInstancesForRefresh to be called in production.',
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function findHostInstancesForMatchingFibersRecursively(
|
||||
fiber: Fiber,
|
||||
types: Set<any>,
|
||||
hostInstances: Set<Instance>,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
const {child, sibling, tag, type} = fiber;
|
||||
|
||||
let candidateType = null;
|
||||
switch (tag) {
|
||||
case FunctionComponent:
|
||||
case SimpleMemoComponent:
|
||||
case ClassComponent:
|
||||
candidateType = type;
|
||||
break;
|
||||
case ForwardRef:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
let didMatch = false;
|
||||
if (candidateType !== null) {
|
||||
if (types.has(candidateType)) {
|
||||
didMatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (didMatch) {
|
||||
// We have a match. This only drills down to the closest host components.
|
||||
// There's no need to search deeper because for the purpose of giving
|
||||
// visual feedback, "flashing" outermost parent rectangles is sufficient.
|
||||
findHostInstancesForFiberShallowly(fiber, hostInstances);
|
||||
} else {
|
||||
// If there's no match, maybe there will be one further down in the child tree.
|
||||
if (child !== null) {
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
child,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (sibling !== null) {
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
sibling,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findHostInstancesForFiberShallowly(
|
||||
fiber: Fiber,
|
||||
hostInstances: Set<Instance>,
|
||||
): void {
|
||||
if (__DEV__) {
|
||||
const foundHostInstances = findChildHostInstancesForFiberShallowly(
|
||||
fiber,
|
||||
hostInstances,
|
||||
);
|
||||
if (foundHostInstances) {
|
||||
return;
|
||||
}
|
||||
// If we didn't find any host children, fallback to closest host parent.
|
||||
let node = fiber;
|
||||
while (true) {
|
||||
switch (node.tag) {
|
||||
case HostComponent:
|
||||
hostInstances.add(node.stateNode);
|
||||
return;
|
||||
case HostPortal:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
case HostRoot:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
}
|
||||
if (node.return === null) {
|
||||
throw new Error('Expected to reach root first.');
|
||||
}
|
||||
node = node.return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findChildHostInstancesForFiberShallowly(
|
||||
fiber: Fiber,
|
||||
hostInstances: Set<Instance>,
|
||||
): boolean {
|
||||
if (__DEV__) {
|
||||
let node: Fiber = fiber;
|
||||
let foundHostInstances = false;
|
||||
while (true) {
|
||||
if (node.tag === HostComponent) {
|
||||
// We got a match.
|
||||
foundHostInstances = true;
|
||||
hostInstances.add(node.stateNode);
|
||||
// There may still be more, so keep searching.
|
||||
} else if (node.child !== null) {
|
||||
node.child.return = node;
|
||||
node = node.child;
|
||||
continue;
|
||||
}
|
||||
if (node === fiber) {
|
||||
return foundHostInstances;
|
||||
}
|
||||
while (node.sibling === null) {
|
||||
if (node.return === null || node.return === fiber) {
|
||||
return foundHostInstances;
|
||||
}
|
||||
node = node.return;
|
||||
}
|
||||
node.sibling.return = node.return;
|
||||
node = node.sibling;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export const setRefreshHandler = enableNewReconciler
|
||||
? setRefreshHandler_new
|
||||
: setRefreshHandler_old;
|
||||
export const resolveFunctionForHotReloading = enableNewReconciler
|
||||
? resolveFunctionForHotReloading_new
|
||||
: resolveFunctionForHotReloading_old;
|
||||
export const resolveClassForHotReloading = enableNewReconciler
|
||||
? resolveClassForHotReloading_new
|
||||
: resolveClassForHotReloading_old;
|
||||
export const resolveForwardRefForHotReloading = enableNewReconciler
|
||||
? resolveForwardRefForHotReloading_new
|
||||
: resolveForwardRefForHotReloading_old;
|
||||
export const isCompatibleFamilyForHotReloading = enableNewReconciler
|
||||
? isCompatibleFamilyForHotReloading_new
|
||||
: isCompatibleFamilyForHotReloading_old;
|
||||
export const markFailedErrorBoundaryForHotReloading = enableNewReconciler
|
||||
? markFailedErrorBoundaryForHotReloading_new
|
||||
: markFailedErrorBoundaryForHotReloading_old;
|
||||
export const scheduleRefresh = enableNewReconciler
|
||||
? scheduleRefresh_new
|
||||
: scheduleRefresh_old;
|
||||
export const scheduleRoot = enableNewReconciler
|
||||
? scheduleRoot_new
|
||||
: scheduleRoot_old;
|
||||
export const findHostInstancesForRefresh = enableNewReconciler
|
||||
? findHostInstancesForRefresh_new
|
||||
: findHostInstancesForRefresh_old;
|
||||
|
|
|
|||
482
packages/react-reconciler/src/ReactFiberHotReloading.old.js
Normal file
482
packages/react-reconciler/src/ReactFiberHotReloading.old.js
Normal file
|
|
@ -0,0 +1,482 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import type {ReactElement} from 'shared/ReactElementType';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {Instance} from './ReactFiberHostConfig';
|
||||
import type {ReactNodeList} from 'shared/ReactTypes';
|
||||
|
||||
import {
|
||||
flushSync,
|
||||
scheduleUpdateOnFiber,
|
||||
flushPassiveEffects,
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {updateContainer, syncUpdates} from './ReactFiberReconciler.old';
|
||||
import {emptyContextObject} from './ReactFiberContext.old';
|
||||
import {Sync} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
ClassComponent,
|
||||
FunctionComponent,
|
||||
ForwardRef,
|
||||
HostComponent,
|
||||
HostPortal,
|
||||
HostRoot,
|
||||
MemoComponent,
|
||||
SimpleMemoComponent,
|
||||
} from './ReactWorkTags';
|
||||
import {
|
||||
REACT_FORWARD_REF_TYPE,
|
||||
REACT_MEMO_TYPE,
|
||||
REACT_LAZY_TYPE,
|
||||
} from 'shared/ReactSymbols';
|
||||
|
||||
export type Family = {|
|
||||
current: any,
|
||||
|};
|
||||
|
||||
export type RefreshUpdate = {|
|
||||
staleFamilies: Set<Family>,
|
||||
updatedFamilies: Set<Family>,
|
||||
|};
|
||||
|
||||
// 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<Family>,
|
||||
) => Set<Instance>;
|
||||
|
||||
let resolveFamily: RefreshHandler | null = null;
|
||||
// $FlowFixMe Flow gets confused by a WeakSet feature check below.
|
||||
let failedBoundaries: WeakSet<Fiber> | null = null;
|
||||
|
||||
export const setRefreshHandler = (handler: RefreshHandler | null): void => {
|
||||
if (__DEV__) {
|
||||
resolveFamily = handler;
|
||||
}
|
||||
};
|
||||
|
||||
export function resolveFunctionForHotReloading(type: any): any {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return type;
|
||||
}
|
||||
const family = resolveFamily(type);
|
||||
if (family === undefined) {
|
||||
return type;
|
||||
}
|
||||
// Use the latest known implementation.
|
||||
return family.current;
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveClassForHotReloading(type: any): any {
|
||||
// No implementation differences.
|
||||
return resolveFunctionForHotReloading(type);
|
||||
}
|
||||
|
||||
export function resolveForwardRefForHotReloading(type: any): any {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return type;
|
||||
}
|
||||
const family = resolveFamily(type);
|
||||
if (family === undefined) {
|
||||
// Check if we're dealing with a real forwardRef. Don't want to crash early.
|
||||
if (
|
||||
type !== null &&
|
||||
type !== undefined &&
|
||||
typeof type.render === 'function'
|
||||
) {
|
||||
// ForwardRef is special because its resolved .type is an object,
|
||||
// but it's possible that we only have its inner render function in the map.
|
||||
// If that inner render function is different, we'll build a new forwardRef type.
|
||||
const currentRender = resolveFunctionForHotReloading(type.render);
|
||||
if (type.render !== currentRender) {
|
||||
const syntheticType = {
|
||||
$$typeof: REACT_FORWARD_REF_TYPE,
|
||||
render: currentRender,
|
||||
};
|
||||
if (type.displayName !== undefined) {
|
||||
(syntheticType: any).displayName = type.displayName;
|
||||
}
|
||||
return syntheticType;
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
// Use the latest known implementation.
|
||||
return family.current;
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
export function isCompatibleFamilyForHotReloading(
|
||||
fiber: Fiber,
|
||||
element: ReactElement,
|
||||
): boolean {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return false;
|
||||
}
|
||||
|
||||
const prevType = fiber.elementType;
|
||||
const nextType = element.type;
|
||||
|
||||
// If we got here, we know types aren't === equal.
|
||||
let needsCompareFamilies = false;
|
||||
|
||||
const $$typeofNextType =
|
||||
typeof nextType === 'object' && nextType !== null
|
||||
? nextType.$$typeof
|
||||
: null;
|
||||
|
||||
switch (fiber.tag) {
|
||||
case ClassComponent: {
|
||||
if (typeof nextType === 'function') {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FunctionComponent: {
|
||||
if (typeof nextType === 'function') {
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
// We don't know the inner type yet.
|
||||
// We're going to assume that the lazy inner type is stable,
|
||||
// and so it is sufficient to avoid reconciling it away.
|
||||
// We're not going to unwrap or actually use the new lazy type.
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ForwardRef: {
|
||||
if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MemoComponent:
|
||||
case SimpleMemoComponent: {
|
||||
if ($$typeofNextType === REACT_MEMO_TYPE) {
|
||||
// TODO: if it was but can no longer be simple,
|
||||
// we shouldn't set this.
|
||||
needsCompareFamilies = true;
|
||||
} else if ($$typeofNextType === REACT_LAZY_TYPE) {
|
||||
needsCompareFamilies = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if both types have a family and it's the same one.
|
||||
if (needsCompareFamilies) {
|
||||
// Note: memo() and forwardRef() we'll compare outer rather than inner type.
|
||||
// This means both of them need to be registered to preserve state.
|
||||
// If we unwrapped and compared the inner types for wrappers instead,
|
||||
// then we would risk falsely saying two separate memo(Foo)
|
||||
// calls are equivalent because they wrap the same Foo function.
|
||||
const prevFamily = resolveFamily(prevType);
|
||||
if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return;
|
||||
}
|
||||
if (typeof WeakSet !== 'function') {
|
||||
return;
|
||||
}
|
||||
if (failedBoundaries === null) {
|
||||
failedBoundaries = new WeakSet();
|
||||
}
|
||||
failedBoundaries.add(fiber);
|
||||
}
|
||||
}
|
||||
|
||||
export const scheduleRefresh: ScheduleRefresh = (
|
||||
root: FiberRoot,
|
||||
update: RefreshUpdate,
|
||||
): void => {
|
||||
if (__DEV__) {
|
||||
if (resolveFamily === null) {
|
||||
// Hot reloading is disabled.
|
||||
return;
|
||||
}
|
||||
const {staleFamilies, updatedFamilies} = update;
|
||||
flushPassiveEffects();
|
||||
flushSync(() => {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
root.current,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const scheduleRoot: ScheduleRoot = (
|
||||
root: FiberRoot,
|
||||
element: ReactNodeList,
|
||||
): void => {
|
||||
if (__DEV__) {
|
||||
if (root.context !== emptyContextObject) {
|
||||
// Super edge case: root has a legacy _renderSubtree context
|
||||
// but we don't know the parentComponent so we can't pass it.
|
||||
// Just ignore. We'll delete this with _renderSubtree code path later.
|
||||
return;
|
||||
}
|
||||
flushPassiveEffects();
|
||||
syncUpdates(() => {
|
||||
updateContainer(element, root, null, null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function scheduleFibersWithFamiliesRecursively(
|
||||
fiber: Fiber,
|
||||
updatedFamilies: Set<Family>,
|
||||
staleFamilies: Set<Family>,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
const {alternate, child, sibling, tag, type} = fiber;
|
||||
|
||||
let candidateType = null;
|
||||
switch (tag) {
|
||||
case FunctionComponent:
|
||||
case SimpleMemoComponent:
|
||||
case ClassComponent:
|
||||
candidateType = type;
|
||||
break;
|
||||
case ForwardRef:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (resolveFamily === null) {
|
||||
throw new Error('Expected resolveFamily to be set during hot reload.');
|
||||
}
|
||||
|
||||
let needsRender = false;
|
||||
let needsRemount = false;
|
||||
if (candidateType !== null) {
|
||||
const family = resolveFamily(candidateType);
|
||||
if (family !== undefined) {
|
||||
if (staleFamilies.has(family)) {
|
||||
needsRemount = true;
|
||||
} else if (updatedFamilies.has(family)) {
|
||||
if (tag === ClassComponent) {
|
||||
needsRemount = true;
|
||||
} else {
|
||||
needsRender = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failedBoundaries !== null) {
|
||||
if (
|
||||
failedBoundaries.has(fiber) ||
|
||||
(alternate !== null && failedBoundaries.has(alternate))
|
||||
) {
|
||||
needsRemount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needsRemount) {
|
||||
fiber._debugNeedsRemount = true;
|
||||
}
|
||||
if (needsRemount || needsRender) {
|
||||
scheduleUpdateOnFiber(fiber, Sync);
|
||||
}
|
||||
if (child !== null && !needsRemount) {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
child,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
}
|
||||
if (sibling !== null) {
|
||||
scheduleFibersWithFamiliesRecursively(
|
||||
sibling,
|
||||
updatedFamilies,
|
||||
staleFamilies,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const findHostInstancesForRefresh: FindHostInstancesForRefresh = (
|
||||
root: FiberRoot,
|
||||
families: Array<Family>,
|
||||
): Set<Instance> => {
|
||||
if (__DEV__) {
|
||||
const hostInstances = new Set();
|
||||
const types = new Set(families.map(family => family.current));
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
root.current,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
return hostInstances;
|
||||
} else {
|
||||
throw new Error(
|
||||
'Did not expect findHostInstancesForRefresh to be called in production.',
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function findHostInstancesForMatchingFibersRecursively(
|
||||
fiber: Fiber,
|
||||
types: Set<any>,
|
||||
hostInstances: Set<Instance>,
|
||||
) {
|
||||
if (__DEV__) {
|
||||
const {child, sibling, tag, type} = fiber;
|
||||
|
||||
let candidateType = null;
|
||||
switch (tag) {
|
||||
case FunctionComponent:
|
||||
case SimpleMemoComponent:
|
||||
case ClassComponent:
|
||||
candidateType = type;
|
||||
break;
|
||||
case ForwardRef:
|
||||
candidateType = type.render;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
let didMatch = false;
|
||||
if (candidateType !== null) {
|
||||
if (types.has(candidateType)) {
|
||||
didMatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (didMatch) {
|
||||
// We have a match. This only drills down to the closest host components.
|
||||
// There's no need to search deeper because for the purpose of giving
|
||||
// visual feedback, "flashing" outermost parent rectangles is sufficient.
|
||||
findHostInstancesForFiberShallowly(fiber, hostInstances);
|
||||
} else {
|
||||
// If there's no match, maybe there will be one further down in the child tree.
|
||||
if (child !== null) {
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
child,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (sibling !== null) {
|
||||
findHostInstancesForMatchingFibersRecursively(
|
||||
sibling,
|
||||
types,
|
||||
hostInstances,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findHostInstancesForFiberShallowly(
|
||||
fiber: Fiber,
|
||||
hostInstances: Set<Instance>,
|
||||
): void {
|
||||
if (__DEV__) {
|
||||
const foundHostInstances = findChildHostInstancesForFiberShallowly(
|
||||
fiber,
|
||||
hostInstances,
|
||||
);
|
||||
if (foundHostInstances) {
|
||||
return;
|
||||
}
|
||||
// If we didn't find any host children, fallback to closest host parent.
|
||||
let node = fiber;
|
||||
while (true) {
|
||||
switch (node.tag) {
|
||||
case HostComponent:
|
||||
hostInstances.add(node.stateNode);
|
||||
return;
|
||||
case HostPortal:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
case HostRoot:
|
||||
hostInstances.add(node.stateNode.containerInfo);
|
||||
return;
|
||||
}
|
||||
if (node.return === null) {
|
||||
throw new Error('Expected to reach root first.');
|
||||
}
|
||||
node = node.return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findChildHostInstancesForFiberShallowly(
|
||||
fiber: Fiber,
|
||||
hostInstances: Set<Instance>,
|
||||
): boolean {
|
||||
if (__DEV__) {
|
||||
let node: Fiber = fiber;
|
||||
let foundHostInstances = false;
|
||||
while (true) {
|
||||
if (node.tag === HostComponent) {
|
||||
// We got a match.
|
||||
foundHostInstances = true;
|
||||
hostInstances.add(node.stateNode);
|
||||
// There may still be more, so keep searching.
|
||||
} else if (node.child !== null) {
|
||||
node.child.return = node;
|
||||
node = node.child;
|
||||
continue;
|
||||
}
|
||||
if (node === fiber) {
|
||||
return foundHostInstances;
|
||||
}
|
||||
while (node.sibling === null) {
|
||||
if (node.return === null || node.return === fiber) {
|
||||
return foundHostInstances;
|
||||
}
|
||||
node = node.return;
|
||||
}
|
||||
node.sibling.return = node.return;
|
||||
node = node.sibling;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {
|
||||
Instance,
|
||||
TextInstance,
|
||||
|
|
@ -16,7 +16,7 @@ import type {
|
|||
Container,
|
||||
HostContext,
|
||||
} from './ReactFiberHostConfig';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
|
||||
|
||||
import {
|
||||
HostComponent,
|
||||
|
|
@ -30,7 +30,7 @@ import invariant from 'shared/invariant';
|
|||
import {
|
||||
createFiberFromHostInstanceForDeletion,
|
||||
createFiberFromDehydratedFragment,
|
||||
} from './ReactFiber';
|
||||
} from './ReactFiber.old';
|
||||
import {
|
||||
shouldSetTextContent,
|
||||
supportsHydration,
|
||||
|
|
@ -55,7 +55,7 @@ import {
|
|||
didNotFindHydratableSuspenseInstance,
|
||||
} from './ReactFiberHostConfig';
|
||||
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
|
||||
import {Never, NoWork} from './ReactFiberExpirationTime';
|
||||
import {Never, NoWork} from './ReactFiberExpirationTime.old';
|
||||
|
||||
// The deepest Fiber on the stack involved in a hydration context.
|
||||
// This may have been an insertion or a hydration.
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
*/
|
||||
|
||||
import type {ReactContext} from 'shared/ReactTypes';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {StackCursor} from './ReactFiberStack';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {StackCursor} from './ReactFiberStack.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
|
||||
export type ContextDependency<T> = {
|
||||
context: ReactContext<T>,
|
||||
|
|
@ -20,7 +20,7 @@ export type ContextDependency<T> = {
|
|||
};
|
||||
|
||||
import {isPrimaryRenderer} from './ReactFiberHostConfig';
|
||||
import {createCursor, push, pop} from './ReactFiberStack';
|
||||
import {createCursor, push, pop} from './ReactFiberStack.old';
|
||||
import {MAX_SIGNED_31_BIT_INT} from './MaxInts';
|
||||
import {
|
||||
ContextProvider,
|
||||
|
|
@ -30,13 +30,9 @@ import {
|
|||
|
||||
import invariant from 'shared/invariant';
|
||||
import is from 'shared/objectIs';
|
||||
import {
|
||||
createUpdate,
|
||||
enqueueUpdate,
|
||||
ForceUpdate,
|
||||
} from 'react-reconciler/src/ReactUpdateQueue';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork';
|
||||
import {createUpdate, enqueueUpdate, ForceUpdate} from './ReactUpdateQueue.old';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
import {markWorkInProgressReceivedUpdate} from './ReactFiberBeginWork.old';
|
||||
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
|
||||
|
||||
const valueCursor: StackCursor<mixed> = createCursor(null);
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {RootTag} from 'react-reconciler/src/ReactRootTags';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {RootTag} from './ReactRootTags';
|
||||
import type {
|
||||
Instance,
|
||||
TextInstance,
|
||||
|
|
@ -19,16 +19,16 @@ import type {
|
|||
import type {RendererInspectionConfig} from './ReactFiberHostConfig';
|
||||
import {FundamentalComponent} from './ReactWorkTags';
|
||||
import type {ReactNodeList, Thenable} from 'shared/ReactTypes';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {
|
||||
SuspenseHydrationCallbacks,
|
||||
SuspenseState,
|
||||
} from './ReactFiberSuspenseComponent';
|
||||
} from './ReactFiberSuspenseComponent.old';
|
||||
|
||||
import {
|
||||
findCurrentHostFiber,
|
||||
findCurrentHostFiberWithNoPortals,
|
||||
} from 'react-reconciler/src/ReactFiberTreeReflection';
|
||||
} from './ReactFiberTreeReflection';
|
||||
import {get as getInstance} from 'shared/ReactInstanceMap';
|
||||
import {
|
||||
HostComponent,
|
||||
|
|
@ -46,9 +46,9 @@ import {
|
|||
processChildContext,
|
||||
emptyContextObject,
|
||||
isContextProvider as isLegacyContextProvider,
|
||||
} from './ReactFiberContext';
|
||||
import {createFiberRoot} from './ReactFiberRoot';
|
||||
import {injectInternals, onScheduleRoot} from './ReactFiberDevToolsHook';
|
||||
} from './ReactFiberContext.old';
|
||||
import {createFiberRoot} from './ReactFiberRoot.old';
|
||||
import {injectInternals, onScheduleRoot} from './ReactFiberDevToolsHook.old';
|
||||
import {
|
||||
requestCurrentTimeForUpdate,
|
||||
computeExpirationForFiber,
|
||||
|
|
@ -67,8 +67,8 @@ import {
|
|||
warnIfNotScopedWithMatchingAct,
|
||||
warnIfUnmockedScheduler,
|
||||
IsThisRendererActing,
|
||||
} from './ReactFiberWorkLoop';
|
||||
import {createUpdate, enqueueUpdate} from './ReactUpdateQueue';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {createUpdate, enqueueUpdate} from './ReactUpdateQueue.old';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
import {
|
||||
isRendering as ReactCurrentFiberIsRendering,
|
||||
|
|
@ -79,14 +79,14 @@ import {
|
|||
Sync,
|
||||
ContinuousHydration,
|
||||
computeInteractiveExpiration,
|
||||
} from './ReactFiberExpirationTime';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
} from './ReactFiberExpirationTime.old';
|
||||
import {requestCurrentSuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
import {
|
||||
scheduleRefresh,
|
||||
scheduleRoot,
|
||||
setRefreshHandler,
|
||||
findHostInstancesForRefresh,
|
||||
} from './ReactFiberHotReloading';
|
||||
} from './ReactFiberHotReloading.old';
|
||||
|
||||
// used by isTestEnvironment builds
|
||||
import enqueueTask from 'shared/enqueueTask';
|
||||
|
|
|
|||
|
|
@ -7,26 +7,26 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {RootTag} from 'react-reconciler/src/ReactRootTags';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.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';
|
||||
import type {SuspenseHydrationCallbacks} from './ReactFiberSuspenseComponent';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {SuspenseHydrationCallbacks} from './ReactFiberSuspenseComponent.old';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {noTimeout} from './ReactFiberHostConfig';
|
||||
import {createHostRootFiber} from './ReactFiber';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
import {createHostRootFiber} from './ReactFiber.old';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
enableSchedulerTracing,
|
||||
enableSuspenseCallback,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {unstable_getThreadID} from 'scheduler/tracing';
|
||||
import {NoPriority} from './SchedulerWithReactIntegration';
|
||||
import {initializeUpdateQueue} from './ReactUpdateQueue';
|
||||
import {clearPendingUpdates as clearPendingMutableSourceUpdates} from './ReactMutableSource';
|
||||
import {NoPriority} from './SchedulerWithReactIntegration.old';
|
||||
import {initializeUpdateQueue} from './ReactUpdateQueue.old';
|
||||
import {clearPendingUpdates as clearPendingMutableSourceUpdates} from './ReactMutableSource.old';
|
||||
|
||||
export type PendingInteractionMap = Map<ExpirationTime, Set<Interaction>>;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {
|
||||
ReactScope,
|
||||
ReactScopeInstance,
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
export type StackCursor<T> = {|current: T|};
|
||||
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {SuspenseInstance} from './ReactFiberHostConfig';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
|
||||
import {NoEffect, DidCapture} from './ReactSideEffectTags';
|
||||
import {
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {StackCursor} from './ReactFiberStack';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {StackCursor} from './ReactFiberStack.old';
|
||||
|
||||
import {createCursor, push, pop} from './ReactFiberStack';
|
||||
import {createCursor, push, pop} from './ReactFiberStack.old';
|
||||
|
||||
export opaque type SuspenseContext = number;
|
||||
export opaque type SubtreeSuspenseContext: SuspenseContext = number;
|
||||
|
|
@ -7,13 +7,13 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {CapturedValue} from './ReactCapturedValue';
|
||||
import type {Update} from './ReactUpdateQueue';
|
||||
import type {Update} from './ReactUpdateQueue.old';
|
||||
import type {Wakeable} from 'shared/ReactTypes';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext';
|
||||
import type {SuspenseContext} from './ReactFiberSuspenseContext.old';
|
||||
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import {
|
||||
|
|
@ -30,7 +30,7 @@ import {
|
|||
LifecycleEffectMask,
|
||||
} from './ReactSideEffectTags';
|
||||
import {NoMode, BlockingMode} from './ReactTypeOfMode';
|
||||
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent';
|
||||
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.old';
|
||||
|
||||
import {createCapturedValue} from './ReactCapturedValue';
|
||||
import {
|
||||
|
|
@ -39,24 +39,24 @@ import {
|
|||
CaptureUpdate,
|
||||
ForceUpdate,
|
||||
enqueueUpdate,
|
||||
} from './ReactUpdateQueue';
|
||||
} from './ReactUpdateQueue.old';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
import {markFailedErrorBoundaryForHotReloading} from './ReactFiberHotReloading';
|
||||
import {markFailedErrorBoundaryForHotReloading} from './ReactFiberHotReloading.old';
|
||||
import {
|
||||
suspenseStackCursor,
|
||||
InvisibleParentSuspenseContext,
|
||||
hasSuspenseContext,
|
||||
} from './ReactFiberSuspenseContext';
|
||||
} from './ReactFiberSuspenseContext.old';
|
||||
import {
|
||||
renderDidError,
|
||||
onUncaughtError,
|
||||
markLegacyErrorBoundaryAsFailed,
|
||||
isAlreadyFailedLegacyErrorBoundary,
|
||||
pingSuspendedRoot,
|
||||
} from './ReactFiberWorkLoop';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
import {logCapturedError} from './ReactFiberErrorLogger';
|
||||
|
||||
import {Sync} from './ReactFiberExpirationTime';
|
||||
import {Sync} from './ReactFiberExpirationTime.old';
|
||||
|
||||
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
||||
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {Container, SuspenseInstance} from './ReactFiberHostConfig';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
|
||||
|
||||
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource';
|
||||
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.old';
|
||||
import {
|
||||
ClassComponent,
|
||||
HostRoot,
|
||||
|
|
@ -24,15 +24,15 @@ import {
|
|||
import {DidCapture, NoEffect, ShouldCapture} from './ReactSideEffectTags';
|
||||
import {enableSuspenseServerRenderer} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {popHostContainer, popHostContext} from './ReactFiberHostContext';
|
||||
import {popSuspenseContext} from './ReactFiberSuspenseContext';
|
||||
import {resetHydrationState} from './ReactFiberHydrationContext';
|
||||
import {popHostContainer, popHostContext} from './ReactFiberHostContext.old';
|
||||
import {popSuspenseContext} from './ReactFiberSuspenseContext.old';
|
||||
import {resetHydrationState} from './ReactFiberHydrationContext.old';
|
||||
import {
|
||||
isContextProvider as isLegacyContextProvider,
|
||||
popContext as popLegacyContext,
|
||||
popTopLevelContextObject as popTopLevelLegacyContextObject,
|
||||
} from './ReactFiberContext';
|
||||
import {popProvider} from './ReactFiberNewContext';
|
||||
} from './ReactFiberContext.old';
|
||||
import {popProvider} from './ReactFiberNewContext.old';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
|
|
@ -8,14 +8,14 @@
|
|||
*/
|
||||
|
||||
import type {Wakeable} from 'shared/ReactTypes';
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {FiberRoot} from './ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
import type {Interaction} from 'scheduler/src/Tracing';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent';
|
||||
import type {Effect as HookEffect} from './ReactFiberHooks';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
|
||||
import type {Effect as HookEffect} from './ReactFiberHooks.old';
|
||||
|
||||
import {
|
||||
warnAboutDeprecatedLifecycles,
|
||||
|
|
@ -49,7 +49,7 @@ import {
|
|||
IdlePriority,
|
||||
flushSyncCallbackQueue,
|
||||
scheduleSyncCallback,
|
||||
} from './SchedulerWithReactIntegration';
|
||||
} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
// The scheduler is imported here *only* to detect whether it's been mocked
|
||||
import * as Scheduler from 'scheduler';
|
||||
|
|
@ -65,14 +65,17 @@ import {
|
|||
warnsIfNotActing,
|
||||
} from './ReactFiberHostConfig';
|
||||
|
||||
import {createWorkInProgress, assignFiberPropertiesInDEV} from './ReactFiber';
|
||||
import {
|
||||
createWorkInProgress,
|
||||
assignFiberPropertiesInDEV,
|
||||
} from './ReactFiber.old';
|
||||
import {
|
||||
isRootSuspendedAtTime,
|
||||
markRootSuspendedAtTime,
|
||||
markRootFinishedAtTime,
|
||||
markRootUpdatedAtTime,
|
||||
markRootExpiredAtTime,
|
||||
} from './ReactFiberRoot';
|
||||
} from './ReactFiberRoot.old';
|
||||
import {
|
||||
NoMode,
|
||||
StrictMode,
|
||||
|
|
@ -91,7 +94,7 @@ import {
|
|||
SimpleMemoComponent,
|
||||
Block,
|
||||
} from './ReactWorkTags';
|
||||
import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
|
||||
import {LegacyRoot} from './ReactRootTags';
|
||||
import {
|
||||
NoEffect,
|
||||
PerformedWork,
|
||||
|
|
@ -122,15 +125,15 @@ import {
|
|||
LOW_PRIORITY_EXPIRATION,
|
||||
Batched,
|
||||
Idle,
|
||||
} from './ReactFiberExpirationTime';
|
||||
import {beginWork as originalBeginWork} from './ReactFiberBeginWork';
|
||||
import {completeWork} from './ReactFiberCompleteWork';
|
||||
import {unwindWork, unwindInterruptedWork} from './ReactFiberUnwindWork';
|
||||
} from './ReactFiberExpirationTime.old';
|
||||
import {beginWork as originalBeginWork} from './ReactFiberBeginWork.old';
|
||||
import {completeWork} from './ReactFiberCompleteWork.old';
|
||||
import {unwindWork, unwindInterruptedWork} from './ReactFiberUnwindWork.old';
|
||||
import {
|
||||
throwException,
|
||||
createRootErrorUpdate,
|
||||
createClassErrorUpdate,
|
||||
} from './ReactFiberThrow';
|
||||
} from './ReactFiberThrow.old';
|
||||
import {
|
||||
commitBeforeMutationLifeCycles as commitBeforeMutationEffectOnFiber,
|
||||
commitLifeCycles as commitLayoutEffectOnFiber,
|
||||
|
|
@ -142,14 +145,14 @@ import {
|
|||
commitAttachRef,
|
||||
commitPassiveEffectDurations,
|
||||
commitResetTextContent,
|
||||
} from './ReactFiberCommitWork';
|
||||
import {enqueueUpdate} from './ReactUpdateQueue';
|
||||
import {resetContextDependencies} from './ReactFiberNewContext';
|
||||
} from './ReactFiberCommitWork.old';
|
||||
import {enqueueUpdate} from './ReactUpdateQueue.old';
|
||||
import {resetContextDependencies} from './ReactFiberNewContext.old';
|
||||
import {
|
||||
resetHooksAfterThrow,
|
||||
ContextOnlyDispatcher,
|
||||
getIsUpdatingOpaqueValueInRenderPhaseInDEV,
|
||||
} from './ReactFiberHooks';
|
||||
} from './ReactFiberHooks.old';
|
||||
import {createCapturedValue} from './ReactCapturedValue';
|
||||
|
||||
import {
|
||||
|
|
@ -158,11 +161,11 @@ import {
|
|||
startPassiveEffectTimer,
|
||||
startProfilerTimer,
|
||||
stopProfilerTimerIfRunningAndRecordDelta,
|
||||
} from './ReactProfilerTimer';
|
||||
} from './ReactProfilerTimer.old';
|
||||
|
||||
// DEV stuff
|
||||
import getComponentName from 'shared/getComponentName';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings';
|
||||
import ReactStrictModeWarnings from './ReactStrictModeWarnings.old';
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
import {
|
||||
isRendering as ReactCurrentDebugFiberIsRenderingInDEV,
|
||||
|
|
@ -174,7 +177,7 @@ import {
|
|||
hasCaughtError,
|
||||
clearCaughtError,
|
||||
} from 'shared/ReactErrorUtils';
|
||||
import {onCommitRoot} from './ReactFiberDevToolsHook';
|
||||
import {onCommitRoot} from './ReactFiberDevToolsHook.old';
|
||||
|
||||
const ceil = Math.ceil;
|
||||
|
||||
|
|
@ -7,12 +7,12 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {ExpirationTime} from 'react-reconciler/src/ReactFiberExpirationTime';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {FiberRoot} from './ReactFiberRoot.old';
|
||||
import type {MutableSource, MutableSourceVersion} from 'shared/ReactTypes';
|
||||
|
||||
import {isPrimaryRenderer} from './ReactFiberHostConfig';
|
||||
import {NoWork} from './ReactFiberExpirationTime';
|
||||
import {NoWork} from './ReactFiberExpirationTime.old';
|
||||
|
||||
// Work in progress version numbers only apply to a single render,
|
||||
// and should be reset before starting a new render.
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
import {
|
||||
enableProfilerTimer,
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
|
||||
import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack';
|
||||
|
||||
|
|
@ -84,16 +84,16 @@
|
|||
// regardless of priority. Intermediate state may vary according to system
|
||||
// resources, but the final state is always the same.
|
||||
|
||||
import type {Fiber} from './ReactFiber';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import type {Fiber} from './ReactFiber.old';
|
||||
import type {ExpirationTime} from './ReactFiberExpirationTime.old';
|
||||
import type {SuspenseConfig} from './ReactFiberSuspenseConfig.old';
|
||||
import type {ReactPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime';
|
||||
import {NoWork, Sync} from './ReactFiberExpirationTime.old';
|
||||
import {
|
||||
enterDisallowedContextReadInDEV,
|
||||
exitDisallowedContextReadInDEV,
|
||||
} from './ReactFiberNewContext';
|
||||
} from './ReactFiberNewContext.old';
|
||||
import {Callback, ShouldCapture, DidCapture} from './ReactSideEffectTags';
|
||||
|
||||
import {debugRenderPhaseSideEffectsForStrictMode} from 'shared/ReactFeatureFlags';
|
||||
|
|
@ -102,10 +102,10 @@ import {StrictMode} from './ReactTypeOfMode';
|
|||
import {
|
||||
markRenderEventTimeAndConfig,
|
||||
markUnprocessedUpdateTime,
|
||||
} from './ReactFiberWorkLoop';
|
||||
} from './ReactFiberWorkLoop.old';
|
||||
|
||||
import invariant from 'shared/invariant';
|
||||
import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration';
|
||||
import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration.old';
|
||||
|
||||
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
|
||||
|
||||
|
|
@ -18,11 +18,14 @@ describe('ReactIncrementalErrorReplay-test', () => {
|
|||
// We almost always try to avoid such tests, but here the cost of
|
||||
// the list getting out of sync (and causing subtle bugs in rare cases)
|
||||
// is higher than the cost of maintaining the test.
|
||||
const {
|
||||
// This is the method we're going to test.
|
||||
// If this is no longer used, you can delete this test file.
|
||||
assignFiberPropertiesInDEV,
|
||||
} = require('../ReactFiber');
|
||||
|
||||
// This is the method we're going to test.
|
||||
// If this is no longer used, you can delete this test file.;
|
||||
|
||||
const assignFiberPropertiesInDEV = require('shared/ReactFeatureFlags')
|
||||
? // TODO: Update this to point to the new module, once it exists
|
||||
require('../ReactFiber.old').assignFiberPropertiesInDEV
|
||||
: require('../ReactFiber.old').assignFiberPropertiesInDEV;
|
||||
|
||||
// Get a real fiber.
|
||||
const realFiber = ReactTestRenderer.create(<div />).root._currentFiber();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from '../ReactFiber';
|
||||
import type {Fiber} from '../ReactFiber.old';
|
||||
import type {CapturedValue} from '../ReactCapturedValue';
|
||||
|
||||
import {ClassComponent} from '../ReactWorkTags';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from '../ReactFiber';
|
||||
import type {Fiber} from '../ReactFiber.old';
|
||||
import type {CapturedValue} from '../ReactCapturedValue';
|
||||
|
||||
import {ClassComponent} from '../ReactWorkTags';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import type {Instance} from 'react-reconciler/src/ReactFiberHostConfig';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
|
||||
import type {
|
||||
Family,
|
||||
RefreshUpdate,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot.old';
|
||||
import type {Instance, TextInstance} from './ReactTestHostConfig';
|
||||
|
||||
import * as Scheduler from 'scheduler/unstable_mock';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
|
||||
|
||||
import ReactCurrentBatchConfig from './ReactCurrentBatchConfig';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig';
|
||||
import type {SuspenseConfig} from 'react-reconciler/src/ReactFiberSuspenseConfig.old';
|
||||
|
||||
/**
|
||||
* Keeps track of the current batch's configuration such as how long an update
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Dispatcher} from 'react-reconciler/src/ReactFiberHooks';
|
||||
import type {Dispatcher} from 'react-reconciler/src/ReactFiberHooks.old';
|
||||
|
||||
/**
|
||||
* Keeps track of the current dispatcher.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
|
||||
/**
|
||||
* Keeps track of the current owner.
|
||||
|
|
|
|||
2
scripts/flow/react-native-host-hooks.js
vendored
2
scripts/flow/react-native-host-hooks.js
vendored
|
|
@ -18,7 +18,7 @@ import type {
|
|||
} from 'react-native-renderer/src/ReactNativeTypes';
|
||||
import type {RNTopLevelEventType} from 'legacy-events/TopLevelEventTypes';
|
||||
import type {CapturedError} from 'react-reconciler/src/ReactCapturedValue';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber';
|
||||
import type {Fiber} from 'react-reconciler/src/ReactFiber.old';
|
||||
|
||||
type DeepDifferOptions = {|+unsafelyIgnoreFunctions?: boolean|};
|
||||
|
||||
|
|
|
|||
|
|
@ -281,6 +281,27 @@ const forks = Object.freeze({
|
|||
return 'react-reconciler/src/ReactFiberReconciler.old.js';
|
||||
},
|
||||
|
||||
'react-reconciler/src/ReactFiberHotReloading': (
|
||||
bundleType,
|
||||
entry,
|
||||
dependencies,
|
||||
moduleType,
|
||||
bundle
|
||||
) => {
|
||||
if (bundle.enableNewReconciler) {
|
||||
switch (bundleType) {
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
case FB_WWW_PROFILING:
|
||||
// Use the forked version of the reconciler
|
||||
// TODO: Update this to point to the new module, once it exists
|
||||
return 'react-reconciler/src/ReactFiberHotReloading.old.js';
|
||||
}
|
||||
}
|
||||
// Otherwise, use the non-forked version.
|
||||
return 'react-reconciler/src/ReactFiberHotReloading.old.js';
|
||||
},
|
||||
|
||||
// Different dialogs for caught errors.
|
||||
'react-reconciler/src/ReactFiberErrorDialog': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user