Skip to content

Commit

Permalink
Move ReactCurrentDispatcher back to shared internals (facebook#27462)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gnoff authored and AndyPengc12 committed Apr 15, 2024
1 parent e2ced98 commit 56d07fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import {
} from 'shared/ReactSerializationErrors';

import {getOrCreateServerContext} from 'shared/ReactServerContextRegistry';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import ReactServerSharedInternals from './ReactServerSharedInternals';
import isArray from 'shared/isArray';
import binaryToComparableString from 'shared/binaryToComparableString';
Expand Down Expand Up @@ -209,9 +210,9 @@ const {
TaintRegistryValues,
TaintRegistryByteLengths,
TaintRegistryPendingRequests,
ReactCurrentDispatcher,
ReactCurrentCache,
} = ReactServerSharedInternals;
const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;

function throwTaintViolation(message: string) {
// eslint-disable-next-line react-internal/prod-error-codes
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/ReactServerSharedInternals.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import ReactCurrentDispatcher from './ReactCurrentDispatcher';
import ReactCurrentCache from './ReactCurrentCache';
import {
TaintRegistryObjects,
Expand All @@ -17,7 +16,6 @@ import {
import {enableTaint} from 'shared/ReactFeatureFlags';

const ReactServerSharedInternals = {
ReactCurrentDispatcher,
ReactCurrentCache,
};

Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/ReactSharedInternalsServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/

import ReactCurrentDispatcher from './ReactCurrentDispatcher';
import ReactCurrentOwner from './ReactCurrentOwner';
import ReactDebugCurrentFrame from './ReactDebugCurrentFrame';
import {enableServerContext} from 'shared/ReactFeatureFlags';
import {ContextRegistry} from './ReactServerContextRegistry';

const ReactSharedInternals = {
ReactCurrentDispatcher,
ReactCurrentOwner,
};

Expand Down

0 comments on commit 56d07fb

Please sign in to comment.