Skip to content

Commit 360f9f7

Browse files
committed
Move ReactDOMLegacy implementation into RootFB
Only the FB entry point has legacy mode now so we can move the remaining code in there.
1 parent 48ec17b commit 360f9f7

File tree

6 files changed

+130
-471
lines changed

6 files changed

+130
-471
lines changed

packages/react-dom/index.classic.fb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ Object.assign((Internals: any), {
2020

2121
export {
2222
createPortal,
23-
findDOMNode,
2423
flushSync,
25-
unmountComponentAtNode,
2624
unstable_createEventHandle,
27-
unstable_renderSubtreeIntoContainer,
2825
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
2926
useFormStatus,
3027
useFormState,
@@ -42,6 +39,9 @@ export {
4239
hydrateRoot,
4340
render,
4441
unstable_batchedUpdates,
42+
findDOMNode,
43+
unstable_renderSubtreeIntoContainer,
44+
unmountComponentAtNode,
4545
} from './src/client/ReactDOMRootFB';
4646

4747
export {Internals as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED};

packages/react-dom/index.stable.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ export {
1313
createRoot,
1414
hydrateRoot,
1515
flushSync,
16-
render,
17-
unmountComponentAtNode,
1816
unstable_batchedUpdates,
19-
unstable_renderSubtreeIntoContainer,
2017
useFormStatus,
2118
useFormState,
2219
prefetchDNS,

packages/react-dom/src/client/ReactDOM.js

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,12 @@
88
*/
99

1010
import type {ReactNodeList} from 'shared/ReactTypes';
11-
import type {
12-
Container,
13-
PublicInstance,
14-
} from 'react-dom-bindings/src/client/ReactFiberConfigDOM';
1511
import type {
1612
RootType,
1713
HydrateRootOptions,
1814
CreateRootOptions,
1915
} from './ReactDOMRoot';
2016

21-
import {
22-
findDOMNode,
23-
render,
24-
unstable_renderSubtreeIntoContainer,
25-
unmountComponentAtNode,
26-
} from './ReactDOMLegacy';
2717
import {
2818
createRoot as createRootImpl,
2919
hydrateRoot as hydrateRootImpl,
@@ -35,6 +25,7 @@ import {
3525
flushSync as flushSyncWithoutWarningIfAlreadyRendering,
3626
isAlreadyRendering,
3727
injectIntoDevTools,
28+
findHostInstance,
3829
} from 'react-reconciler/src/ReactFiberReconciler';
3930
import {runWithPriority} from 'react-reconciler/src/ReactEventPriorities';
4031
import {createPortal as createPortalImpl} from 'react-reconciler/src/ReactPortal';
@@ -99,20 +90,6 @@ function createPortal(
9990
return createPortalImpl(children, container, null, key);
10091
}
10192

102-
function renderSubtreeIntoContainer(
103-
parentComponent: React$Component<any, any>,
104-
element: React$Element<any>,
105-
containerNode: Container,
106-
callback: ?Function,
107-
): React$Component<any, any> | PublicInstance | null {
108-
return unstable_renderSubtreeIntoContainer(
109-
parentComponent,
110-
element,
111-
containerNode,
112-
callback,
113-
);
114-
}
115-
11693
function createRoot(
11794
container: Element | Document | DocumentFragment,
11895
options?: CreateRootOptions,
@@ -163,6 +140,12 @@ function flushSync<R>(fn: (() => R) | void): R | void {
163140
return flushSyncWithoutWarningIfAlreadyRendering(fn);
164141
}
165142

143+
function findDOMNode(
144+
componentOrElement: Element | ?React$Component<any, any>,
145+
): null | Element | Text {
146+
return findHostInstance(componentOrElement);
147+
}
148+
166149
// Expose findDOMNode on internals
167150
Internals.findDOMNode = findDOMNode;
168151

@@ -178,15 +161,9 @@ export {
178161
unstable_batchedUpdates,
179162
flushSync,
180163
ReactVersion as version,
181-
// Disabled behind disableLegacyReactDOMAPIs
182-
findDOMNode,
183-
render,
184-
unmountComponentAtNode,
185164
// exposeConcurrentModeAPIs
186165
createRoot,
187166
hydrateRoot,
188-
// Disabled behind disableUnstableRenderSubtreeIntoContainer
189-
renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer,
190167
// enableCreateEventHandleAPI
191168
createEventHandle as unstable_createEventHandle,
192169
// TODO: Remove this once callers migrate to alternatives.

0 commit comments

Comments
 (0)