Remove string refs (behind flag) (#28322)

Depends on:

- https://github.com/facebook/react/pull/28398

---

This removes string refs, which has been deprecated in Strict Mode for
seven years.

I've left them behind a flag for Meta, but in open source this fully
removes the feature.

DiffTrain build for [c9798954e2](https://github.com/facebook/react/commit/c9798954e26a2354a951cc65607f2901a45bf035)
This commit is contained in:
acdlite
2024-02-27 16:46:52 +00:00
parent 9509de9485
commit d76cf6bbfe
21 changed files with 60 additions and 33 deletions
@@ -1216,7 +1216,9 @@ if (__DEV__) {
ref = config.ref;
}
warnIfStringRefCannotBeAutoConverted(config, self);
{
warnIfStringRefCannotBeAutoConverted(config, self);
}
} // Remaining properties are added to a new props object
for (propName in config) {
@@ -1216,7 +1216,9 @@ if (__DEV__) {
ref = config.ref;
}
warnIfStringRefCannotBeAutoConverted(config, self);
{
warnIfStringRefCannotBeAutoConverted(config, self);
}
} // Remaining properties are added to a new props object
for (propName in config) {
+1 -1
View File
@@ -1 +1 @@
3bcd2de01b5716202eabe8faa338f51bdc59ce26
c9798954e26a2354a951cc65607f2901a45bf035
+4 -2
View File
@@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-classic-cca960ca";
var ReactVersion = "18.3.0-www-classic-e2cea41c";
// ATTENTION
// When adding new symbols to this file,
@@ -1621,7 +1621,9 @@ if (__DEV__) {
ref = config.ref;
}
warnIfStringRefCannotBeAutoConverted(config, self);
{
warnIfStringRefCannotBeAutoConverted(config, self);
}
} // Remaining properties are added to a new props object
for (propName in config) {
+4 -2
View File
@@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-www-modern-f3ad7d8a";
var ReactVersion = "18.3.0-www-modern-c68f569b";
// ATTENTION
// When adding new symbols to this file,
@@ -1621,7 +1621,9 @@ if (__DEV__) {
ref = config.ref;
}
warnIfStringRefCannotBeAutoConverted(config, self);
{
warnIfStringRefCannotBeAutoConverted(config, self);
}
} // Remaining properties are added to a new props object
for (propName in config) {
+1 -1
View File
@@ -625,4 +625,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-53c0b633";
exports.version = "18.3.0-www-classic-17784f7e";
+1 -1
View File
@@ -617,4 +617,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-29517cf7";
exports.version = "18.3.0-www-modern-7f5681e6";
@@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}
var ReactVersion = "18.3.0-www-classic-10cc6982";
var ReactVersion = "18.3.0-www-classic-1b14a8b4";
var LegacyRoot = 0;
var ConcurrentRoot = 1;
@@ -198,7 +198,7 @@ if (__DEV__) {
var enableAsyncActions = true; // Logs additional User Timing API marks for use with an experimental profiling tool.
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -22173,6 +22173,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
+4 -2
View File
@@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}
var ReactVersion = "18.3.0-www-modern-615fb07a";
var ReactVersion = "18.3.0-www-modern-bbc162b8";
var LegacyRoot = 0;
var ConcurrentRoot = 1;
@@ -198,7 +198,7 @@ if (__DEV__) {
var enableAsyncActions = true; // Logs additional User Timing API marks for use with an experimental profiling tool.
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -21832,6 +21832,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -166,7 +166,7 @@ if (__DEV__) {
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableSuspenseCallback = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -27703,6 +27703,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -36001,7 +36003,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-classic-ca77f61d";
var ReactVersion = "18.3.0-www-classic-a1d5cd42";
function createPortal$1(
children,
+4 -2
View File
@@ -152,7 +152,7 @@ if (__DEV__) {
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableSuspenseCallback = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var ReactSharedInternals =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -27548,6 +27548,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -35837,7 +35839,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-modern-bb7d97c5";
var ReactVersion = "18.3.0-www-modern-9dd8ecfb";
function createPortal$1(
children,
@@ -17473,7 +17473,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1862 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-615fb07a",
version: "18.3.0-www-modern-bbc162b8",
rendererPackageName: "react-dom"
};
(function (internals) {
@@ -17518,7 +17518,7 @@ var devToolsConfig$jscomp$inline_1862 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-615fb07a"
reconcilerVersion: "18.3.0-www-modern-bbc162b8"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.createPortal = function (children, container) {
@@ -17776,7 +17776,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "18.3.0-www-modern-615fb07a";
exports.version = "18.3.0-www-modern-bbc162b8";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");
var ReactVersion = "18.3.0-www-classic-79137864";
var ReactVersion = "18.3.0-www-classic-aafe6508";
// This refers to a WWW module.
var warningWWW = require("warning");
@@ -684,7 +684,7 @@ if (__DEV__) {
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, false is used for a new modern build.
var enableFloat = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
// $FlowFixMe[method-unbinding]
var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");
var ReactVersion = "18.3.0-www-modern-4a76bb56";
var ReactVersion = "18.3.0-www-modern-cc760041";
// This refers to a WWW module.
var warningWWW = require("warning");
@@ -684,7 +684,7 @@ if (__DEV__) {
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, true is used for a new modern build.
var enableFloat = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
// $FlowFixMe[method-unbinding]
var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -681,7 +681,7 @@ if (__DEV__) {
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
// On WWW, true is used for a new modern build.
var enableFloat = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
// $FlowFixMe[method-unbinding]
var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -158,7 +158,7 @@ if (__DEV__) {
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableSuspenseCallback = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var FunctionComponent = 0;
var ClassComponent = 1;
@@ -27840,6 +27840,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -36625,7 +36627,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-classic-53c0b633";
var ReactVersion = "18.3.0-www-classic-17784f7e";
function createPortal$1(
children,
@@ -144,7 +144,7 @@ if (__DEV__) {
var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler;
var enableSuspenseCallback = true;
var enableBigIntSupport = false; // Flow magic to verify the exports of this file match the original version.
var enableBigIntSupport = false; // TODO: Roll out with GK. Don't keep as dynamic flag for too long, though,
var ReactSharedInternals =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -27685,6 +27685,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -36461,7 +36463,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-modern-ebf69536";
var ReactVersion = "18.3.0-www-modern-7c91c8e8";
function createPortal$1(
children,
@@ -1334,7 +1334,9 @@ if (__DEV__) {
ref = config.ref;
}
warnIfStringRefCannotBeAutoConverted(config, self);
{
warnIfStringRefCannotBeAutoConverted(config, self);
}
} // Remaining properties are added to a new props object
for (propName in config) {
@@ -2798,7 +2800,7 @@ if (__DEV__) {
console["error"](error);
};
var ReactVersion = "18.3.0-www-modern-7c3fd7c0";
var ReactVersion = "18.3.0-www-modern-6846d4a2";
// Patch fetch
var Children = {
@@ -19330,6 +19330,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -26097,7 +26099,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-classic-44b067ca";
var ReactVersion = "18.3.0-www-classic-b441c74f";
// Might add PROFILE later.
@@ -19330,6 +19330,8 @@ if (__DEV__) {
}
} else {
{
// TODO: We should move these warnings to happen during the render
// phase (markRef).
if (!ref.hasOwnProperty("current")) {
error(
"Unexpected ref object provided for %s. " +
@@ -26097,7 +26099,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-www-modern-55fd2e28";
var ReactVersion = "18.3.0-www-modern-bcdfc2da";
// Might add PROFILE later.
@@ -277,6 +277,7 @@ export default [
"Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.",
"Should have found matching lanes. This is a bug in React.",
"State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().",
"String refs are no longer supported.",
"Style property values shouldn't contain a semicolon. Try \"%s: %s\" instead.",
"Symbols are not valid as a React child.\n %s",
"Symbols are not valid as a React child.\n <%s>%s</%s>",