Skip to content

Commit 98bf00d

Browse files
committed
Add Server Context deprecation warning (#27424)
As agreed, we're removing Server Context. This was never official documented. We've found that it's not that useful in practice. Often the better options are: - Read things off the url or global scope like params or cookies. - Use the module system for global dependency injection. - Use `React.cache()` to dedupe multiple things instead of computing once and passing down. There are still legit use cases for Server Context but you have to be very careful not to pass any large data, so in generally we recommend against it anyway. Yes, prop drilling is annoying but it's not impossible for the cases this is needed. I would personally always pick it over Server Context anyway. Semantically, Server Context also blocks object deduping due to how it plays out with Server Components that can't be deduped. This is much more important feature. Since it's already in canary along with the rest of RSC, we're adding a warning for a few versions before removing completely to help migration. --------- Co-authored-by: Josh Story <[email protected]> DiffTrain build for commit 1ebedbe.
1 parent e640317 commit 98bf00d

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23985,7 +23985,7 @@ function createFiberRoot(
2398523985
return root;
2398623986
}
2398723987

23988-
var ReactVersion = "18.3.0-canary-34de2986d-20230927";
23988+
var ReactVersion = "18.3.0-canary-1ebedbec2-20230928";
2398923989

2399023990
// Might add PROFILE later.
2399123991

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1027 = {
86208620
throw Error("TestRenderer does not support findFiberByHostInstance()");
86218621
},
86228622
bundleType: 0,
8623-
version: "18.3.0-canary-34de2986d-20230927",
8623+
version: "18.3.0-canary-1ebedbec2-20230928",
86248624
rendererPackageName: "react-test-renderer"
86258625
};
86268626
var internals$jscomp$inline_1226 = {
@@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1226 = {
86518651
scheduleRoot: null,
86528652
setRefreshHandler: null,
86538653
getCurrentFiber: null,
8654-
reconcilerVersion: "18.3.0-canary-34de2986d-20230927"
8654+
reconcilerVersion: "18.3.0-canary-1ebedbec2-20230928"
86558655
};
86568656
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86578657
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1069 = {
90469046
throw Error("TestRenderer does not support findFiberByHostInstance()");
90479047
},
90489048
bundleType: 0,
9049-
version: "18.3.0-canary-34de2986d-20230927",
9049+
version: "18.3.0-canary-1ebedbec2-20230928",
90509050
rendererPackageName: "react-test-renderer"
90519051
};
90529052
var internals$jscomp$inline_1267 = {
@@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1267 = {
90779077
scheduleRoot: null,
90789078
setRefreshHandler: null,
90799079
getCurrentFiber: null,
9080-
reconcilerVersion: "18.3.0-canary-34de2986d-20230927"
9080+
reconcilerVersion: "18.3.0-canary-1ebedbec2-20230928"
90819081
};
90829082
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
90839083
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7acac2f2a74dcdd0d337dca60149a207>>
10+
* @generated SignedSource<<8e6aba2a8a22d8a171df886dcebe4930>>
1111
*/
1212

1313
'use strict';
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-canary-34de2986d-20230927";
30+
var ReactVersion = "18.3.0-canary-1ebedbec2-20230928";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,
@@ -2706,6 +2706,14 @@ function cloneElementWithValidation(element, props, children) {
27062706

27072707
var ContextRegistry = ReactSharedInternals.ContextRegistry;
27082708
function createServerContext(globalName, defaultValue) {
2709+
{
2710+
error(
2711+
"Server Context is deprecated and will soon be removed. " +
2712+
"It was never documented and we have found it not to be useful " +
2713+
"enough to warrant the downside it imposes on all apps."
2714+
);
2715+
}
2716+
27092717
var wasDefined = true;
27102718

27112719
if (!ContextRegistry[globalName]) {

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
616616
exports.useTransition = function () {
617617
return ReactCurrentDispatcher.current.useTransition();
618618
};
619-
exports.version = "18.3.0-canary-34de2986d-20230927";
619+
exports.version = "18.3.0-canary-1ebedbec2-20230928";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
619619
exports.useTransition = function () {
620620
return ReactCurrentDispatcher.current.useTransition();
621621
};
622-
exports.version = "18.3.0-canary-34de2986d-20230927";
622+
exports.version = "18.3.0-canary-1ebedbec2-20230928";
623623

624624
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
625625
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
34de2986dfeddda31cb76d298c6d59b271d976fa
1+
1ebedbec2bec08e07c286ea6c3cff62737a0fd3a

0 commit comments

Comments
 (0)