Restrict React DOM imports from Server Components (#27382)

Adds a separate entry point for the react-dom package when it's accessed
from a Server Component environment, using the "react-server" export
condition.

When you're inside a Server Component module, you won't be able to
import client-only APIs like useState. This applies to almost all React
DOM exports, except for Float ones like preload.

DiffTrain build for commit https://github.com/facebook/react/commit/2d2f2af29bc3175530a158bc90189fc6f12f7855.
This commit is contained in:
acdlite
2023-09-15 18:57:58 +00:00
parent 4570bc02f2
commit 7e99c2a606
7 changed files with 9 additions and 9 deletions
@@ -23998,7 +23998,7 @@ function createFiberRoot(
return root;
}
var ReactVersion = "18.3.0-canary-d6dcad6a8-20230914";
var ReactVersion = "18.3.0-canary-2d2f2af29-20230915";
// Might add PROFILE later.
@@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1028 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-d6dcad6a8-20230914",
version: "18.3.0-canary-2d2f2af29-20230915",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1227 = {
@@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1227 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-d6dcad6a8-20230914"
reconcilerVersion: "18.3.0-canary-2d2f2af29-20230915"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1228 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1070 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-d6dcad6a8-20230914",
version: "18.3.0-canary-2d2f2af29-20230915",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1268 = {
@@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1268 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-d6dcad6a8-20230914"
reconcilerVersion: "18.3.0-canary-2d2f2af29-20230915"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1269 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -27,7 +27,7 @@ if (
}
"use strict";
var ReactVersion = "18.3.0-canary-d6dcad6a8-20230914";
var ReactVersion = "18.3.0-canary-2d2f2af29-20230915";
// ATTENTION
// When adding new symbols to this file,
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-d6dcad6a8-20230914";
exports.version = "18.3.0-canary-2d2f2af29-20230915";
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-d6dcad6a8-20230914";
exports.version = "18.3.0-canary-2d2f2af29-20230915";
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
@@ -1 +1 @@
d6dcad6a8beaeec0513a9851d1e0fe1181932360
2d2f2af29bc3175530a158bc90189fc6f12f7855