Plumbing of isomorphic code (#29967)
Need to tighten up this a bit. react-dom isomorphic currently depends on react-reconciler which is mostly DCE but it's pulled in which makes it hard to make other bundling changes. ReactFlightServer can have a hard dependency on the module that imports its internals since even if other internals are aliased it still always needs the server one.
Sebastian Markbåge committed
Jun 21, 2024 at 12:39 UTC
6fb39ec9e9b9aa0242d981c1b89473f02c6f945b
3 files changed
+7
-5
packages/react-dom/src/ReactDOMSharedInternals.js
+3
-1
@@ -10,7 +10,9 @@
10
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
11
import type {HostDispatcher} from './shared/ReactDOMTypes';
12
13
-import {NoEventPriority} from 'react-reconciler/src/ReactEventPriorities';
13
+// This should line up with NoEventPriority from react-reconciler/src/ReactEventPriorities
14
+// but we can't depend on the react-reconciler from this isomorphic code.
15
+export const NoEventPriority: EventPriority = (0: any);
16
17
type ReactDOMInternals = {
18
d /* ReactDOMCurrentDispatcher */: HostDispatcher,
packages/react-server/src/ReactFlightServer.js
+1
-3
@@ -118,9 +118,7 @@ import {
118
objectName,
119
} from 'shared/ReactSerializationErrors';
120
121
-import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';
122
-import ReactSharedInternalsImpl from 'shared/ReactSharedInternals';
123
-const ReactSharedInternals: SharedStateServer = (ReactSharedInternalsImpl: any);
121
+import ReactSharedInternals from './ReactSharedInternalsServer';
122
import isArray from 'shared/isArray';
123
import getPrototypeOf from 'shared/getPrototypeOf';
124
import binaryToComparableString from 'shared/binaryToComparableString';
packages/react-server/src/ReactSharedInternalsServer.js
+3
-1
@@ -7,9 +7,11 @@
7
* @flow
8
*/
9
10
+import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';
11
+
12
import * as React from 'react';
13
12
-const ReactSharedInternalsServer =
14
+const ReactSharedInternalsServer: SharedStateServer =
15
// $FlowFixMe: It's defined in the one we resolve to.
16
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
17