Move ReactCurrentDispatcher back to shared internals (#27462)
The jsx-runtime uses the ReactCurrentDispatcher from shared internals. Recently this was moved to ReactServerSharedInternals which broke jsx-runtime. This change moves it back to ReactSharedInternals until we can come up with a new forking mechanism.
Josh Story committed
Oct 4, 2023 at 13:16 UTC
6f132439578ee11e04b41a278df51c52b0dc8563
3 files changed
+4
-3
packages/react-server/src/ReactFlightServer.js
+2
-1
@@ -108,6 +108,7 @@ import {
108
} from 'shared/ReactSerializationErrors';
109
110
import {getOrCreateServerContext} from 'shared/ReactServerContextRegistry';
111
+import ReactSharedInternals from 'shared/ReactSharedInternals';
112
import ReactServerSharedInternals from './ReactServerSharedInternals';
113
import isArray from 'shared/isArray';
114
import binaryToComparableString from 'shared/binaryToComparableString';
@@ -209,9 +210,9 @@ const {
210
TaintRegistryValues,
211
TaintRegistryByteLengths,
212
TaintRegistryPendingRequests,
212
- ReactCurrentDispatcher,
213
ReactCurrentCache,
214
} = ReactServerSharedInternals;
215
+const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
216
217
function throwTaintViolation(message: string) {
218
// eslint-disable-next-line react-internal/prod-error-codes
packages/react/src/ReactServerSharedInternals.js
-2
@@ -5,7 +5,6 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
-import ReactCurrentDispatcher from './ReactCurrentDispatcher';
8
import ReactCurrentCache from './ReactCurrentCache';
9
import {
10
TaintRegistryObjects,
@@ -17,7 +16,6 @@ import {
16
import {enableTaint} from 'shared/ReactFeatureFlags';
17
18
const ReactServerSharedInternals = {
20
- ReactCurrentDispatcher,
19
ReactCurrentCache,
20
};
21
packages/react/src/ReactSharedInternalsServer.js
+2
@@ -5,12 +5,14 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
+import ReactCurrentDispatcher from './ReactCurrentDispatcher';
9
import ReactCurrentOwner from './ReactCurrentOwner';
10
import ReactDebugCurrentFrame from './ReactDebugCurrentFrame';
11
import {enableServerContext} from 'shared/ReactFeatureFlags';
12
import {ContextRegistry} from './ReactServerContextRegistry';
13
14
const ReactSharedInternals = {
15
+ ReactCurrentDispatcher,
16
ReactCurrentOwner,
17
};
18