Skip to content

Commit 9b5375d

Browse files
committed
Disable ServerContext in canary (#27474)
We previously added a warning in #27424. This just removes it from canary/stable channels but keeps it in experimental for now. DiffTrain build for [1fc5828](1fc5828)
1 parent 1713d0f commit 9b5375d

31 files changed

+69
-602
lines changed

compiled/facebook-www/JSXDEVRuntime-dev.classic.js

-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
2929
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
3030
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
3131
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
32-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
3332
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
3433
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
3534
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
@@ -255,11 +254,6 @@ function getComponentNameFromType(type) {
255254
return null;
256255
}
257256
}
258-
259-
case REACT_SERVER_CONTEXT_TYPE: {
260-
var context2 = type;
261-
return (context2.displayName || context2._globalName) + ".Provider";
262-
}
263257
}
264258
}
265259

compiled/facebook-www/JSXDEVRuntime-dev.modern.js

-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
2929
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
3030
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
3131
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
32-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
3332
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
3433
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
3534
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
@@ -255,11 +254,6 @@ function getComponentNameFromType(type) {
255254
return null;
256255
}
257256
}
258-
259-
case REACT_SERVER_CONTEXT_TYPE: {
260-
var context2 = type;
261-
return (context2.displayName || context2._globalName) + ".Provider";
262-
}
263257
}
264258
}
265259

compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
537228f9fd703d18bea1f6d20fa0e5006b795c42
1+
1fc58281af73ca4507c41d53a3e08dc2038b0c1f

compiled/facebook-www/React-dev.classic.js

+1-98
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-classic-01108d4a";
30+
var ReactVersion = "18.3.0-www-classic-d874e0af";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,
@@ -40,7 +40,6 @@ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
4040
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
4141
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
4242
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
43-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
4443
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
4544
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
4645
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
@@ -52,9 +51,6 @@ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
5251
var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden");
5352
var REACT_CACHE_TYPE = Symbol.for("react.cache");
5453
var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker");
55-
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for(
56-
"react.default_value"
57-
);
5854
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
5955
var FAUX_ITERATOR_SYMBOL = "@@iterator";
6056
function getIteratorFn(maybeIterable) {
@@ -584,11 +580,6 @@ function getComponentNameFromType(type) {
584580
return null;
585581
}
586582
}
587-
588-
case REACT_SERVER_CONTEXT_TYPE: {
589-
var context2 = type;
590-
return (context2.displayName || context2._globalName) + ".Provider";
591-
}
592583
}
593584
}
594585

@@ -2177,8 +2168,6 @@ function setExtraStackFrame(stack) {
21772168
};
21782169
}
21792170

2180-
var ContextRegistry = {};
2181-
21822171
var ReactSharedInternals = {
21832172
ReactCurrentDispatcher: ReactCurrentDispatcher$1,
21842173
ReactCurrentCache: ReactCurrentCache,
@@ -2191,10 +2180,6 @@ var ReactSharedInternals = {
21912180
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
21922181
}
21932182

2194-
{
2195-
ReactSharedInternals.ContextRegistry = ContextRegistry;
2196-
}
2197-
21982183
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
21992184
var prefix;
22002185
function describeBuiltInComponentFrame(name, source, ownerFn) {
@@ -2947,87 +2932,6 @@ function cloneElementWithValidation(element, props, children) {
29472932
return newElement;
29482933
}
29492934

2950-
function createServerContext(globalName, defaultValue) {
2951-
{
2952-
error(
2953-
"Server Context is deprecated and will soon be removed. " +
2954-
"It was never documented and we have found it not to be useful " +
2955-
"enough to warrant the downside it imposes on all apps."
2956-
);
2957-
}
2958-
2959-
var wasDefined = true;
2960-
2961-
if (!ContextRegistry[globalName]) {
2962-
wasDefined = false;
2963-
var _context = {
2964-
$$typeof: REACT_SERVER_CONTEXT_TYPE,
2965-
// As a workaround to support multiple concurrent renderers, we categorize
2966-
// some renderers as primary and others as secondary. We only expect
2967-
// there to be two concurrent renderers at most: React Native (primary) and
2968-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
2969-
// Secondary renderers store their context values on separate fields.
2970-
_currentValue: defaultValue,
2971-
_currentValue2: defaultValue,
2972-
_defaultValue: defaultValue,
2973-
// Used to track how many concurrent renderers this context currently
2974-
// supports within in a single renderer. Such as parallel server rendering.
2975-
_threadCount: 0,
2976-
// These are circular
2977-
Provider: null,
2978-
Consumer: null,
2979-
_globalName: globalName
2980-
};
2981-
_context.Provider = {
2982-
$$typeof: REACT_PROVIDER_TYPE,
2983-
_context: _context
2984-
};
2985-
2986-
{
2987-
var hasWarnedAboutUsingConsumer;
2988-
_context._currentRenderer = null;
2989-
_context._currentRenderer2 = null;
2990-
Object.defineProperties(_context, {
2991-
Consumer: {
2992-
get: function () {
2993-
if (!hasWarnedAboutUsingConsumer) {
2994-
error("Consumer pattern is not supported by ReactServerContext");
2995-
2996-
hasWarnedAboutUsingConsumer = true;
2997-
}
2998-
2999-
return null;
3000-
}
3001-
}
3002-
});
3003-
}
3004-
3005-
ContextRegistry[globalName] = _context;
3006-
}
3007-
3008-
var context = ContextRegistry[globalName];
3009-
3010-
if (context._defaultValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
3011-
context._defaultValue = defaultValue;
3012-
3013-
if (
3014-
context._currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED
3015-
) {
3016-
context._currentValue = defaultValue;
3017-
}
3018-
3019-
if (
3020-
context._currentValue2 === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED
3021-
) {
3022-
context._currentValue2 = defaultValue;
3023-
}
3024-
} else if (wasDefined) {
3025-
throw new Error("ServerContext: " + globalName + " already defined");
3026-
}
3027-
3028-
return context;
3029-
}
3030-
30312935
function startTransition(scope, options) {
30322936
var prevTransition = ReactCurrentBatchConfig.transition;
30332937
ReactCurrentBatchConfig.transition = {};
@@ -4165,7 +4069,6 @@ exports.createContext = createContext;
41654069
exports.createElement = createElement;
41664070
exports.createFactory = createFactory;
41674071
exports.createRef = createRef;
4168-
exports.createServerContext = createServerContext;
41694072
exports.experimental_useEffectEvent = useEffectEvent;
41704073
exports.forwardRef = forwardRef;
41714074
exports.isValidElement = isValidElement$1;

compiled/facebook-www/React-dev.modern.js

+1-98
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-6dbff8b1";
30+
var ReactVersion = "18.3.0-www-modern-872bdfba";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,
@@ -40,7 +40,6 @@ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
4040
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
4141
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
4242
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
43-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
4443
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
4544
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
4645
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
@@ -52,9 +51,6 @@ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
5251
var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden");
5352
var REACT_CACHE_TYPE = Symbol.for("react.cache");
5453
var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker");
55-
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for(
56-
"react.default_value"
57-
);
5854
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
5955
var FAUX_ITERATOR_SYMBOL = "@@iterator";
6056
function getIteratorFn(maybeIterable) {
@@ -584,11 +580,6 @@ function getComponentNameFromType(type) {
584580
return null;
585581
}
586582
}
587-
588-
case REACT_SERVER_CONTEXT_TYPE: {
589-
var context2 = type;
590-
return (context2.displayName || context2._globalName) + ".Provider";
591-
}
592583
}
593584
}
594585

@@ -2177,8 +2168,6 @@ function setExtraStackFrame(stack) {
21772168
};
21782169
}
21792170

2180-
var ContextRegistry = {};
2181-
21822171
var ReactSharedInternals = {
21832172
ReactCurrentDispatcher: ReactCurrentDispatcher$1,
21842173
ReactCurrentCache: ReactCurrentCache,
@@ -2191,10 +2180,6 @@ var ReactSharedInternals = {
21912180
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
21922181
}
21932182

2194-
{
2195-
ReactSharedInternals.ContextRegistry = ContextRegistry;
2196-
}
2197-
21982183
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
21992184
var prefix;
22002185
function describeBuiltInComponentFrame(name, source, ownerFn) {
@@ -2913,87 +2898,6 @@ function cloneElementWithValidation(element, props, children) {
29132898
return newElement;
29142899
}
29152900

2916-
function createServerContext(globalName, defaultValue) {
2917-
{
2918-
error(
2919-
"Server Context is deprecated and will soon be removed. " +
2920-
"It was never documented and we have found it not to be useful " +
2921-
"enough to warrant the downside it imposes on all apps."
2922-
);
2923-
}
2924-
2925-
var wasDefined = true;
2926-
2927-
if (!ContextRegistry[globalName]) {
2928-
wasDefined = false;
2929-
var _context = {
2930-
$$typeof: REACT_SERVER_CONTEXT_TYPE,
2931-
// As a workaround to support multiple concurrent renderers, we categorize
2932-
// some renderers as primary and others as secondary. We only expect
2933-
// there to be two concurrent renderers at most: React Native (primary) and
2934-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
2935-
// Secondary renderers store their context values on separate fields.
2936-
_currentValue: defaultValue,
2937-
_currentValue2: defaultValue,
2938-
_defaultValue: defaultValue,
2939-
// Used to track how many concurrent renderers this context currently
2940-
// supports within in a single renderer. Such as parallel server rendering.
2941-
_threadCount: 0,
2942-
// These are circular
2943-
Provider: null,
2944-
Consumer: null,
2945-
_globalName: globalName
2946-
};
2947-
_context.Provider = {
2948-
$$typeof: REACT_PROVIDER_TYPE,
2949-
_context: _context
2950-
};
2951-
2952-
{
2953-
var hasWarnedAboutUsingConsumer;
2954-
_context._currentRenderer = null;
2955-
_context._currentRenderer2 = null;
2956-
Object.defineProperties(_context, {
2957-
Consumer: {
2958-
get: function () {
2959-
if (!hasWarnedAboutUsingConsumer) {
2960-
error("Consumer pattern is not supported by ReactServerContext");
2961-
2962-
hasWarnedAboutUsingConsumer = true;
2963-
}
2964-
2965-
return null;
2966-
}
2967-
}
2968-
});
2969-
}
2970-
2971-
ContextRegistry[globalName] = _context;
2972-
}
2973-
2974-
var context = ContextRegistry[globalName];
2975-
2976-
if (context._defaultValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
2977-
context._defaultValue = defaultValue;
2978-
2979-
if (
2980-
context._currentValue === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED
2981-
) {
2982-
context._currentValue = defaultValue;
2983-
}
2984-
2985-
if (
2986-
context._currentValue2 === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED
2987-
) {
2988-
context._currentValue2 = defaultValue;
2989-
}
2990-
} else if (wasDefined) {
2991-
throw new Error("ServerContext: " + globalName + " already defined");
2992-
}
2993-
2994-
return context;
2995-
}
2996-
29972901
function startTransition(scope, options) {
29982902
var prevTransition = ReactCurrentBatchConfig.transition;
29992903
ReactCurrentBatchConfig.transition = {};
@@ -4129,7 +4033,6 @@ exports.cloneElement = cloneElement;
41294033
exports.createContext = createContext;
41304034
exports.createElement = createElement;
41314035
exports.createRef = createRef;
4132-
exports.createServerContext = createServerContext;
41334036
exports.experimental_useEffectEvent = useEffectEvent;
41344037
exports.forwardRef = forwardRef;
41354038
exports.isValidElement = isValidElement$1;

0 commit comments

Comments
 (0)