Skip to content

Commit

Permalink
[Flight] Delete Server Context (#28225)
Browse files Browse the repository at this point in the history
Server Context was never documented, and has been deprecated in
#27424.

This PR removes it completely, including the implementation code.

Notably, `useContext` is removed from the shared subset, so importing it
from a React Server environment would now should be a build error in
environments that are able to enforce that.

DiffTrain build for [4728548](4728548)
  • Loading branch information
gaearon committed Feb 5, 2024
1 parent b505fe3 commit c178d6f
Show file tree
Hide file tree
Showing 40 changed files with 294 additions and 1,210 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
95ec128399a8b34884cc6bd90a041e03ce5c1844
472854820bfd0058dfc85524051171c7b7c998c1
7 changes: 2 additions & 5 deletions compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-classic-609987b0";
var ReactVersion = "18.3.0-www-classic-82bfc644";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2411,10 +2411,7 @@ if (__DEV__) {
_threadCount: 0,
// These are circular
Provider: null,
Consumer: null,
// Add these to use same hidden class in VM as ServerContext
_defaultValue: null,
_globalName: null
Consumer: null
};
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down
7 changes: 2 additions & 5 deletions compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-modern-9aca347c";
var ReactVersion = "18.3.0-www-modern-00e8e94b";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2376,10 +2376,7 @@ if (__DEV__) {
_threadCount: 0,
// These are circular
Provider: null,
Consumer: null,
// Add these to use same hidden class in VM as ServerContext
_defaultValue: null,
_globalName: null
Consumer: null
};
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down
6 changes: 2 additions & 4 deletions compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,7 @@ exports.createContext = function (defaultValue) {
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};
defaultValue.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down Expand Up @@ -572,4 +570,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-416dbb8d";
exports.version = "18.3.0-www-classic-838f52b1";
6 changes: 2 additions & 4 deletions compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,7 @@ exports.createContext = function (defaultValue) {
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};
defaultValue.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down Expand Up @@ -564,4 +562,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-b506e46f";
exports.version = "18.3.0-www-modern-ec0970fd";
6 changes: 2 additions & 4 deletions compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ exports.createContext = function (defaultValue) {
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};
defaultValue.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down Expand Up @@ -576,7 +574,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-f4afa597";
exports.version = "18.3.0-www-classic-ca403e34";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 2 additions & 4 deletions compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,7 @@ exports.createContext = function (defaultValue) {
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};
defaultValue.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
Expand Down Expand Up @@ -568,7 +566,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-41ffe01a";
exports.version = "18.3.0-www-modern-aeab456d";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
40 changes: 9 additions & 31 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "18.3.0-www-classic-e82d96aa";
var ReactVersion = "18.3.0-www-classic-14b2377a";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -237,7 +237,6 @@ if (__DEV__) {
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
Expand Down Expand Up @@ -4059,9 +4058,7 @@ if (__DEV__) {
_currentValue2: null,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};

function requiredContext(c) {
Expand Down Expand Up @@ -6928,10 +6925,7 @@ if (__DEV__) {
return createChild(returnFiber, unwrapThenable(thenable), lanes);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return createChild(
returnFiber,
Expand Down Expand Up @@ -7015,10 +7009,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return updateSlot(
returnFiber,
Expand Down Expand Up @@ -7119,10 +7110,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return updateFromMap(
existingChildren,
Expand Down Expand Up @@ -7829,10 +7817,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return reconcileChildFibersImpl(
returnFiber,
Expand Down Expand Up @@ -8996,10 +8981,7 @@ if (__DEV__) {
// This is a thenable.
var thenable = usable;
return useThenable(thenable);
} else if (
usable.$$typeof === REACT_CONTEXT_TYPE ||
usable.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
} else if (usable.$$typeof === REACT_CONTEXT_TYPE) {
var context = usable;
return readContext(context);
}
Expand Down Expand Up @@ -18273,9 +18255,7 @@ if (__DEV__) {
var currentValue = valueCursor.current;

{
{
context._currentValue2 = currentValue;
}
context._currentValue2 = currentValue;

{
var currentRenderer2 = renderer2CursorDEV.current;
Expand Down Expand Up @@ -18922,9 +18902,7 @@ if (__DEV__) {
// We'll initialize these at the root.
_currentValue: null,
_currentValue2: null,
_threadCount: 0,
_defaultValue: null,
_globalName: null
_threadCount: 0
};

{
Expand Down
40 changes: 9 additions & 31 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "18.3.0-www-modern-f1f6b170";
var ReactVersion = "18.3.0-www-modern-d7f69305";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -237,7 +237,6 @@ if (__DEV__) {
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
Expand Down Expand Up @@ -3809,9 +3808,7 @@ if (__DEV__) {
_currentValue2: null,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
Consumer: null
};

function requiredContext(c) {
Expand Down Expand Up @@ -6678,10 +6675,7 @@ if (__DEV__) {
return createChild(returnFiber, unwrapThenable(thenable), lanes);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return createChild(
returnFiber,
Expand Down Expand Up @@ -6765,10 +6759,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return updateSlot(
returnFiber,
Expand Down Expand Up @@ -6869,10 +6860,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return updateFromMap(
existingChildren,
Expand Down Expand Up @@ -7579,10 +7567,7 @@ if (__DEV__) {
);
}

if (
newChild.$$typeof === REACT_CONTEXT_TYPE ||
newChild.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
if (newChild.$$typeof === REACT_CONTEXT_TYPE) {
var context = newChild;
return reconcileChildFibersImpl(
returnFiber,
Expand Down Expand Up @@ -8746,10 +8731,7 @@ if (__DEV__) {
// This is a thenable.
var thenable = usable;
return useThenable(thenable);
} else if (
usable.$$typeof === REACT_CONTEXT_TYPE ||
usable.$$typeof === REACT_SERVER_CONTEXT_TYPE
) {
} else if (usable.$$typeof === REACT_CONTEXT_TYPE) {
var context = usable;
return readContext(context);
}
Expand Down Expand Up @@ -17946,9 +17928,7 @@ if (__DEV__) {
var currentValue = valueCursor.current;

{
{
context._currentValue2 = currentValue;
}
context._currentValue2 = currentValue;

{
var currentRenderer2 = renderer2CursorDEV.current;
Expand Down Expand Up @@ -18595,9 +18575,7 @@ if (__DEV__) {
// We'll initialize these at the root.
_currentValue: null,
_currentValue2: null,
_threadCount: 0,
_defaultValue: null,
_globalName: null
_threadCount: 0
};

{
Expand Down
Loading

0 comments on commit c178d6f

Please sign in to comment.