Skip to content

Commit 6fb39ec

Browse files
authored
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.
1 parent 0f56841 commit 6fb39ec

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Diff for: packages/react-dom/src/ReactDOMSharedInternals.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
1111
import type {HostDispatcher} from './shared/ReactDOMTypes';
1212

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);
1416

1517
type ReactDOMInternals = {
1618
d /* ReactDOMCurrentDispatcher */: HostDispatcher,

Diff for: packages/react-server/src/ReactFlightServer.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ import {
118118
objectName,
119119
} from 'shared/ReactSerializationErrors';
120120

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';
124122
import isArray from 'shared/isArray';
125123
import getPrototypeOf from 'shared/getPrototypeOf';
126124
import binaryToComparableString from 'shared/binaryToComparableString';

Diff for: packages/react-server/src/ReactSharedInternalsServer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
* @flow
88
*/
99

10+
import type {SharedStateServer} from 'react/src/ReactSharedInternalsServer';
11+
1012
import * as React from 'react';
1113

12-
const ReactSharedInternalsServer =
14+
const ReactSharedInternalsServer: SharedStateServer =
1315
// $FlowFixMe: It's defined in the one we resolve to.
1416
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
1517

0 commit comments

Comments
 (0)