Skip to content

Commit

Permalink
Remove Reconciler fork infra
Browse files Browse the repository at this point in the history
  • Loading branch information
kassens committed Dec 1, 2022
1 parent 030dae2 commit 64b77c9
Show file tree
Hide file tree
Showing 40 changed files with 67 additions and 926 deletions.
8 changes: 0 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ module.exports = {
'react-internal/no-to-warn-dev-within-to-throw': ERROR,
'react-internal/warning-args': ERROR,
'react-internal/no-production-logging': ERROR,
'react-internal/no-cross-fork-imports': ERROR,
'react-internal/no-cross-fork-types': [
ERROR,
{
old: [],
new: [],
},
],
},

overrides: [
Expand Down
1 change: 0 additions & 1 deletion packages/react-dom/index.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export {
unstable_batchedUpdates,
unstable_createEventHandle,
unstable_flushControlled,
unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
Expand Down
1 change: 0 additions & 1 deletion packages/react-dom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export {
unstable_batchedUpdates,
unstable_createEventHandle,
unstable_flushControlled,
unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
Expand Down
1 change: 0 additions & 1 deletion packages/react-dom/index.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export {
unstable_batchedUpdates,
unstable_createEventHandle,
unstable_flushControlled,
unstable_isNewReconciler,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
preload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('react-dom-server-rendering-stub', () => {
expect(ReactDOM.unstable_batchedUpdates).toBe(undefined);
expect(ReactDOM.unstable_createEventHandle).toBe(undefined);
expect(ReactDOM.unstable_flushControlled).toBe(undefined);
expect(ReactDOM.unstable_isNewReconciler).toBe(undefined);
expect(ReactDOM.unstable_renderSubtreeIntoContainer).toBe(undefined);
expect(ReactDOM.unstable_runWithPriority).toBe(undefined);
});
Expand Down
3 changes: 0 additions & 3 deletions packages/react-dom/src/client/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
import {createPortal as createPortalImpl} from 'react-reconciler/src/ReactPortal';
import {canUseDOM} from 'shared/ExecutionEnvironment';
import ReactVersion from 'shared/ReactVersion';
import {enableNewReconciler} from 'shared/ReactFeatureFlags';

import {
getClosestInstanceFromNode,
Expand Down Expand Up @@ -256,5 +255,3 @@ if (__DEV__) {
}
}
}

export const unstable_isNewReconciler = enableNewReconciler;
2 changes: 1 addition & 1 deletion packages/react-noop-renderer/src/createReactNoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
Fiber,
TransitionTracingCallbacks,
} from 'react-reconciler/src/ReactInternalTypes';
import type {UpdateQueue} from 'react-reconciler/src/ReactFiberClassUpdateQueue.new';
import type {UpdateQueue} from 'react-reconciler/src/ReactFiberClassUpdateQueue';
import type {ReactNodeList} from 'shared/ReactTypes';
import type {RootTag} from 'react-reconciler/src/ReactRootTags';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/DebugTracing.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import type {Lane, Lanes} from './ReactFiberLane.old';
import type {Lane, Lanes} from './ReactFiberLane.new';
import type {Wakeable} from 'shared/ReactTypes';

import {enableDebugTracing} from 'shared/ReactFeatureFlags';
Expand Down
71 changes: 9 additions & 62 deletions packages/react-reconciler/src/ReactEventPriorities.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,15 @@
* @flow
*/

import {enableNewReconciler} from 'shared/ReactFeatureFlags';

import {
DiscreteEventPriority as DiscreteEventPriority_old,
ContinuousEventPriority as ContinuousEventPriority_old,
DefaultEventPriority as DefaultEventPriority_old,
IdleEventPriority as IdleEventPriority_old,
getCurrentUpdatePriority as getCurrentUpdatePriority_old,
setCurrentUpdatePriority as setCurrentUpdatePriority_old,
runWithPriority as runWithPriority_old,
isHigherEventPriority as isHigherEventPriority_old,
} from './ReactEventPriorities.old';

import {
DiscreteEventPriority as DiscreteEventPriority_new,
ContinuousEventPriority as ContinuousEventPriority_new,
DefaultEventPriority as DefaultEventPriority_new,
IdleEventPriority as IdleEventPriority_new,
getCurrentUpdatePriority as getCurrentUpdatePriority_new,
setCurrentUpdatePriority as setCurrentUpdatePriority_new,
runWithPriority as runWithPriority_new,
isHigherEventPriority as isHigherEventPriority_new,
export {
DiscreteEventPriority,
ContinuousEventPriority,
DefaultEventPriority,
IdleEventPriority,
getCurrentUpdatePriority,
setCurrentUpdatePriority,
runWithPriority,
isHigherEventPriority,
} from './ReactEventPriorities.new';

export opaque type EventPriority = number;

export const DiscreteEventPriority: EventPriority = enableNewReconciler
? (DiscreteEventPriority_new: any)
: (DiscreteEventPriority_old: any);
export const ContinuousEventPriority: EventPriority = enableNewReconciler
? (ContinuousEventPriority_new: any)
: (ContinuousEventPriority_old: any);
export const DefaultEventPriority: EventPriority = enableNewReconciler
? (DefaultEventPriority_new: any)
: (DefaultEventPriority_old: any);
export const IdleEventPriority: EventPriority = enableNewReconciler
? (IdleEventPriority_new: any)
: (IdleEventPriority_old: any);

export function runWithPriority<T>(priority: EventPriority, fn: () => T): T {
return enableNewReconciler
? runWithPriority_new((priority: any), fn)
: runWithPriority_old((priority: any), fn);
}

export function getCurrentUpdatePriority(): EventPriority {
return enableNewReconciler
? (getCurrentUpdatePriority_new(): any)
: (getCurrentUpdatePriority_old(): any);
}

export function setCurrentUpdatePriority(priority: EventPriority): void {
return enableNewReconciler
? setCurrentUpdatePriority_new((priority: any))
: setCurrentUpdatePriority_old((priority: any));
}

export function isHigherEventPriority(
a: EventPriority,
b: EventPriority,
): boolean {
return enableNewReconciler
? isHigherEventPriority_new((a: any), (b: any))
: isHigherEventPriority_old((a: any), (b: any));
}
23 changes: 0 additions & 23 deletions packages/react-reconciler/src/ReactFiberHooks.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
enableDebugTracing,
enableSchedulingProfiler,
enableNewReconciler,
enableCache,
enableUseRefAccessWarning,
enableLazyContextPropagation,
Expand Down Expand Up @@ -2758,8 +2757,6 @@ export const ContextOnlyDispatcher: Dispatcher = {
useMutableSource: throwInvalidHookError,
useSyncExternalStore: throwInvalidHookError,
useId: throwInvalidHookError,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(ContextOnlyDispatcher: Dispatcher).useCacheRefresh = throwInvalidHookError;
Expand Down Expand Up @@ -2793,8 +2790,6 @@ const HooksDispatcherOnMount: Dispatcher = {
useMutableSource: mountMutableSource,
useSyncExternalStore: mountSyncExternalStore,
useId: mountId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
// $FlowFixMe[escaped-generic] discovered when updating Flow
Expand Down Expand Up @@ -2828,8 +2823,6 @@ const HooksDispatcherOnUpdate: Dispatcher = {
useMutableSource: updateMutableSource,
useSyncExternalStore: updateSyncExternalStore,
useId: updateId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh;
Expand Down Expand Up @@ -2863,8 +2856,6 @@ const HooksDispatcherOnRerender: Dispatcher = {
useMutableSource: updateMutableSource,
useSyncExternalStore: updateSyncExternalStore,
useId: updateId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnRerender: Dispatcher).useCacheRefresh = updateRefresh;
Expand Down Expand Up @@ -3041,8 +3032,6 @@ if (__DEV__) {
mountHookTypesDev();
return mountId();
},

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3198,8 +3187,6 @@ if (__DEV__) {
updateHookTypesDev();
return mountId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3355,8 +3342,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3513,8 +3498,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3687,8 +3670,6 @@ if (__DEV__) {
mountHookTypesDev();
return mountId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3872,8 +3853,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -4058,8 +4037,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down
23 changes: 0 additions & 23 deletions packages/react-reconciler/src/ReactFiberHooks.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
enableDebugTracing,
enableSchedulingProfiler,
enableNewReconciler,
enableCache,
enableUseRefAccessWarning,
enableLazyContextPropagation,
Expand Down Expand Up @@ -2758,8 +2757,6 @@ export const ContextOnlyDispatcher: Dispatcher = {
useMutableSource: throwInvalidHookError,
useSyncExternalStore: throwInvalidHookError,
useId: throwInvalidHookError,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(ContextOnlyDispatcher: Dispatcher).useCacheRefresh = throwInvalidHookError;
Expand Down Expand Up @@ -2793,8 +2790,6 @@ const HooksDispatcherOnMount: Dispatcher = {
useMutableSource: mountMutableSource,
useSyncExternalStore: mountSyncExternalStore,
useId: mountId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
// $FlowFixMe[escaped-generic] discovered when updating Flow
Expand Down Expand Up @@ -2828,8 +2823,6 @@ const HooksDispatcherOnUpdate: Dispatcher = {
useMutableSource: updateMutableSource,
useSyncExternalStore: updateSyncExternalStore,
useId: updateId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh;
Expand Down Expand Up @@ -2863,8 +2856,6 @@ const HooksDispatcherOnRerender: Dispatcher = {
useMutableSource: updateMutableSource,
useSyncExternalStore: updateSyncExternalStore,
useId: updateId,

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnRerender: Dispatcher).useCacheRefresh = updateRefresh;
Expand Down Expand Up @@ -3041,8 +3032,6 @@ if (__DEV__) {
mountHookTypesDev();
return mountId();
},

unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3198,8 +3187,6 @@ if (__DEV__) {
updateHookTypesDev();
return mountId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3355,8 +3342,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3513,8 +3498,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(HooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3687,8 +3670,6 @@ if (__DEV__) {
mountHookTypesDev();
return mountId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -3872,8 +3853,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down Expand Up @@ -4058,8 +4037,6 @@ if (__DEV__) {
updateHookTypesDev();
return updateId();
},
unstable_isNewReconciler: enableNewReconciler,
};
if (enableCache) {
(InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useCacheRefresh = function useCacheRefresh() {
Expand Down
22 changes: 3 additions & 19 deletions packages/react-reconciler/src/ReactFiberHostContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,8 @@
*/

import type {Container, HostContext} from './ReactFiberHostConfig';
import {enableNewReconciler} from 'shared/ReactFeatureFlags';

import {
getCurrentRootHostContainer as getCurrentRootHostContainer_old,
getHostContext as getHostContext_old,
} from './ReactFiberHostContext.old';

import {
getCurrentRootHostContainer as getCurrentRootHostContainer_new,
getHostContext as getHostContext_new,
export {
getCurrentRootHostContainer,
getHostContext,
} from './ReactFiberHostContext.new';

export function getCurrentRootHostContainer(): null | Container {
return enableNewReconciler
? getCurrentRootHostContainer_new()
: getCurrentRootHostContainer_old();
}

export function getHostContext(): HostContext {
return enableNewReconciler ? getHostContext_new() : getHostContext_old();
}
Loading

0 comments on commit 64b77c9

Please sign in to comment.