Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsx(): Treat __self and __source as normal props #28257

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 6, 2024

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.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 6, 2024
@react-sizebot
Copy link

react-sizebot commented Feb 6, 2024

Comparing: 1beb941...0054097

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 176.66 kB 176.66 kB = 55.01 kB 55.01 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.65 kB 178.65 kB = 55.59 kB 55.59 kB
facebook-www/ReactDOM-prod.classic.js = 591.78 kB 591.78 kB = 104.44 kB 104.44 kB
facebook-www/ReactDOM-prod.modern.js = 575.53 kB 575.53 kB = 101.54 kB 101.54 kB
oss-stable-semver/react/cjs/react.react-server.production.js +2.79% 29.70 kB 30.53 kB +2.03% 8.90 kB 9.09 kB
oss-stable/react/cjs/react.react-server.production.js +2.79% 29.73 kB 30.56 kB +2.04% 8.93 kB 9.11 kB
oss-stable-semver/react/cjs/react.production.js +2.40% 34.59 kB 35.42 kB +2.04% 9.62 kB 9.82 kB
oss-stable/react/cjs/react.production.js +2.40% 34.62 kB 35.45 kB +2.05% 9.65 kB 9.85 kB
oss-experimental/react/cjs/react.react-server.production.js +2.32% 35.82 kB 36.65 kB +1.67% 10.58 kB 10.76 kB
oss-experimental/react/cjs/react.production.js +2.23% 37.23 kB 38.06 kB +1.93% 10.29 kB 10.49 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-experimental/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
facebook-react-native/react/cjs/JSXRuntime-prod.js = 1.49 kB 1.43 kB = 0.71 kB 0.70 kB
facebook-react-native/react/cjs/JSXRuntime-profiling.js = 1.49 kB 1.43 kB = 0.71 kB 0.70 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react/cjs/react.react-server.production.js +2.79% 29.70 kB 30.53 kB +2.03% 8.90 kB 9.09 kB
oss-stable/react/cjs/react.react-server.production.js +2.79% 29.73 kB 30.56 kB +2.04% 8.93 kB 9.11 kB
oss-stable-semver/react/cjs/react.production.js +2.40% 34.59 kB 35.42 kB +2.04% 9.62 kB 9.82 kB
oss-stable/react/cjs/react.production.js +2.40% 34.62 kB 35.45 kB +2.05% 9.65 kB 9.85 kB
oss-experimental/react/cjs/react.react-server.production.js +2.32% 35.82 kB 36.65 kB +1.67% 10.58 kB 10.76 kB
oss-experimental/react/cjs/react.production.js +2.23% 37.23 kB 38.06 kB +1.93% 10.29 kB 10.49 kB
oss-stable-semver/react/cjs/react.react-server.development.js +1.07% 77.65 kB 78.48 kB +0.89% 21.46 kB 21.65 kB
oss-stable/react/cjs/react.react-server.development.js +1.07% 77.68 kB 78.51 kB +0.90% 21.49 kB 21.68 kB
oss-experimental/react/cjs/react.react-server.development.js +0.99% 84.11 kB 84.94 kB +0.80% 23.35 kB 23.54 kB
oss-stable-semver/react/cjs/react.development.js +0.81% 101.95 kB 102.78 kB +0.66% 27.25 kB 27.42 kB
oss-stable/react/cjs/react.development.js +0.81% 101.98 kB 102.81 kB +0.66% 27.27 kB 27.46 kB
oss-experimental/react/cjs/react.development.js +0.79% 104.51 kB 105.34 kB +0.67% 27.91 kB 28.10 kB
facebook-www/ReactServer-dev.modern.js +0.74% 108.91 kB 109.71 kB +1.51% 25.99 kB 26.38 kB
oss-stable-semver/react/umd/react.development.js +0.68% 125.03 kB 125.88 kB +0.64% 31.96 kB 32.16 kB
oss-stable/react/umd/react.development.js +0.68% 125.06 kB 125.91 kB +0.65% 31.98 kB 32.19 kB
oss-experimental/react/umd/react.development.js +0.67% 127.70 kB 128.55 kB +0.64% 32.66 kB 32.87 kB
facebook-react-native/react/cjs/React-dev.js +0.62% 129.19 kB 129.99 kB +0.59% 29.77 kB 29.95 kB
facebook-www/React-dev.modern.js +0.57% 141.25 kB 142.05 kB +1.17% 34.17 kB 34.57 kB
facebook-www/React-dev.classic.js +0.56% 142.47 kB 143.27 kB +1.15% 34.42 kB 34.82 kB
facebook-www/React-profiling.classic.js = 19.16 kB 19.09 kB = 4.85 kB 4.84 kB
facebook-www/React-profiling.modern.js = 18.86 kB 18.80 kB = 4.77 kB 4.76 kB
facebook-www/React-prod.classic.js = 18.72 kB 18.66 kB = 4.76 kB 4.76 kB
facebook-www/React-prod.modern.js = 18.43 kB 18.37 kB = 4.69 kB 4.68 kB
facebook-react-native/react/cjs/React-profiling.js = 17.90 kB 17.83 kB = 4.60 kB 4.59 kB
facebook-react-native/react/cjs/React-prod.js = 17.76 kB 17.69 kB = 4.59 kB 4.58 kB
facebook-www/ReactServer-prod.modern.js = 14.97 kB 14.91 kB = 3.96 kB 3.95 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.js = 4.22 kB 4.17 kB = 1.88 kB 1.87 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.js = 4.22 kB 4.17 kB = 1.88 kB 1.87 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.js = 4.22 kB 4.17 kB = 1.88 kB 1.87 kB
oss-experimental/react/cjs/react-jsx-runtime.production.js = 4.14 kB 4.08 kB = 1.84 kB 1.83 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.js = 4.14 kB 4.08 kB = 1.84 kB 1.83 kB
oss-stable/react/cjs/react-jsx-runtime.production.js = 4.14 kB 4.08 kB = 1.84 kB 1.83 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.js = 4.13 kB 4.08 kB = 1.84 kB 1.83 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.js = 4.13 kB 4.08 kB = 1.84 kB 1.83 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.js = 4.13 kB 4.08 kB = 1.84 kB 1.83 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.91 kB 0.88 kB = 0.56 kB 0.55 kB
oss-experimental/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable/react/cjs/react-jsx-runtime.production.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.min.js = 0.89 kB 0.86 kB = 0.55 kB 0.54 kB
facebook-react-native/react/cjs/JSXRuntime-prod.js = 1.49 kB 1.43 kB = 0.71 kB 0.70 kB
facebook-react-native/react/cjs/JSXRuntime-profiling.js = 1.49 kB 1.43 kB = 0.71 kB 0.70 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Generated by 🚫 dangerJS against 0054097

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.
@acdlite acdlite merged commit 91caa96 into facebook:main Feb 7, 2024
36 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 7, 2024
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)
@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Feb 8, 2024

I don't think this is right because it'll start breaking existing code that's compiled and shipped to npm.

EDIT: Nvm. I see that this only removes them from JSX but not createElement.

// TODO: These will no longer be reserved in the next major
propName !== 'ref' &&
propName !== '__self' &&
propName !== '__source'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These really shouldn't have been filtered out from the start since they're passed as separate arguments in this transform.

// 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment could be updated to reflect that we need to keep them for legacy purposes for React.createElement calls but they're not actually used anymore.

EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
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.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
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 commit 91caa96.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants