Skip to content

Commit

Permalink
jsx(): Treat __self and __source as normal props (#28257)
Browse files Browse the repository at this point in the history
These used to be reserved props because the classic React.createElement
runtime passed this data as props, whereas the jsxDEV() runtime passes
them as separate arguments.

This brings us incrementally closer to being able to pass the props
object directly through to React instead of cloning a subset into a new
object.

The React.createElement runtime is unaffected.

DiffTrain build for [91caa96](91caa96)
  • Loading branch information
acdlite committed Feb 7, 2024
1 parent 7a01513 commit 126187e
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 55 deletions.
6 changes: 2 additions & 4 deletions compiled/facebook-www/JSXDEVRuntime-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,8 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "__self" &&
propName !== "__source"
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
Expand Down
6 changes: 2 additions & 4 deletions compiled/facebook-www/JSXDEVRuntime-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,8 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "__self" &&
propName !== "__source"
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f07ac1e2680a26c5b3bf9c651d62c792de71d46d
91caa96e4261704d42333f5e02ba32d870379fc4
26 changes: 17 additions & 9 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-715010bd";
var ReactVersion = "18.3.0-www-classic-87aadbfe";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -834,8 +834,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -967,8 +972,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -1909,10 +1919,8 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "__self" &&
propName !== "__source"
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
Expand Down
26 changes: 17 additions & 9 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-20a278f7";
var ReactVersion = "18.3.0-www-modern-fe0a8b28";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -834,8 +834,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -967,8 +972,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -1909,10 +1919,8 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "__self" &&
propName !== "__source"
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
Expand Down
4 changes: 1 addition & 3 deletions compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ function jsx$1(type, config, maybeKey) {
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
Expand Down Expand Up @@ -577,4 +575,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-a3f180e9";
exports.version = "18.3.0-www-classic-88f429a3";
4 changes: 1 addition & 3 deletions compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ function jsx$1(type, config, maybeKey) {
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
Expand Down Expand Up @@ -569,4 +567,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-97ff7924";
exports.version = "18.3.0-www-modern-8e8077b5";
4 changes: 1 addition & 3 deletions compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ function jsx$1(type, config, maybeKey) {
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
Expand Down Expand Up @@ -581,7 +579,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-classic-a4e84017";
exports.version = "18.3.0-www-classic-5f5e8f54";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
4 changes: 1 addition & 3 deletions compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ function jsx$1(type, config, maybeKey) {
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
Expand Down Expand Up @@ -573,7 +571,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-www-modern-4076c0c0";
exports.version = "18.3.0-www-modern-cc698d7e";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -36374,7 +36374,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-www-classic-a3f180e9";
var ReactVersion = "18.3.0-www-classic-88f429a3";

function createPortal$1(
children,
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17490,7 +17490,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1828 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-classic-a4e84017",
version: "18.3.0-www-classic-5f5e8f54",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2197 = {
Expand Down Expand Up @@ -17520,7 +17520,7 @@ var internals$jscomp$inline_2197 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-classic-a4e84017"
reconcilerVersion: "18.3.0-www-classic-5f5e8f54"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2198 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18021,4 +18021,4 @@ exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
throw Error(formatProdErrorMessage(248));
};
exports.version = "18.3.0-www-classic-a4e84017";
exports.version = "18.3.0-www-classic-5f5e8f54";
26 changes: 17 additions & 9 deletions compiled/facebook-www/ReactServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -759,8 +764,13 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref" && // ...and maybe these, too, though we currently rely on them for
// warnings and debug information in dev. Need to decide if we're OK
// with dropping them. In the jsx() runtime it's not an issue because
// the data gets passed as separate arguments instead of props, but
// it would be nice to stop relying on them entirely so we can drop
// them from the internal Fiber field.
propName !== "__self" &&
propName !== "__source"
) {
Expand Down Expand Up @@ -1622,10 +1632,8 @@ if (__DEV__) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) && // Skip over reserved prop names
propName !== "key" && // TODO: These will no longer be reserved in the next major
propName !== "ref" &&
propName !== "__self" &&
propName !== "__source"
propName !== "key" && // TODO: `ref` will no longer be reserved in the next major
propName !== "ref"
) {
props[propName] = config[propName];
}
Expand Down Expand Up @@ -2871,7 +2879,7 @@ if (__DEV__) {
console["error"](error);
};

var ReactVersion = "18.3.0-www-modern-e6ecad30";
var ReactVersion = "18.3.0-www-modern-2e3e0251";

// Patch fetch
var Children = {
Expand Down
4 changes: 1 addition & 3 deletions compiled/facebook-www/ReactServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ function jsx$1(type, config, maybeKey) {
hasOwnProperty.call(config, propName) &&
"key" !== propName &&
"ref" !== propName &&
"__self" !== propName &&
"__source" !== propName &&
(props[propName] = config[propName]);
if (type && type.defaultProps)
for (propName in ((config = type.defaultProps), config))
Expand Down Expand Up @@ -475,4 +473,4 @@ exports.useId = function () {
exports.useMemo = function (create, deps) {
return ReactCurrentDispatcher.current.useMemo(create, deps);
};
exports.version = "18.3.0-www-modern-48d2dc77";
exports.version = "18.3.0-www-modern-a97dcea7";

0 comments on commit 126187e

Please sign in to comment.