Skip to content

jsx(): Inline reserved prop checks #28262

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 6, 2024

The JSX runtime (both the new one and the classic createElement runtime) check for reserved props like key and ref by doing a lookup in a plain object map with hasOwnProperty.

There are only a few reserved props so this inlines the checks instead.

The JSX runtime (both the new one and the classic createElement runtime)
check for reserved props like `key` and `ref` by doing a lookup in
a plain object map with `hasOwnProperty`.

There are only a few reserved props so this inlines the checks instead.
@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

Comparing: 0d11563...8144840

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
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-experimental/react/cjs/react-jsx-runtime.profiling.js +1.62% 4.07 kB 4.13 kB +1.38% 1.82 kB 1.84 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.js +1.62% 4.07 kB 4.13 kB +1.38% 1.82 kB 1.84 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.js +1.62% 4.07 kB 4.13 kB +1.38% 1.82 kB 1.84 kB
oss-experimental/react/cjs/react-jsx-runtime.production.js +1.62% 4.07 kB 4.14 kB +1.43% 1.82 kB 1.84 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.js +1.62% 4.07 kB 4.14 kB +1.43% 1.82 kB 1.84 kB
oss-stable/react/cjs/react-jsx-runtime.production.js +1.62% 4.07 kB 4.14 kB +1.43% 1.82 kB 1.84 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.js +1.59% 4.15 kB 4.22 kB +1.40% 1.85 kB 1.88 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.js +1.59% 4.15 kB 4.22 kB +1.40% 1.85 kB 1.88 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.js +1.59% 4.15 kB 4.22 kB +1.40% 1.85 kB 1.88 kB
oss-stable-semver/react/cjs/react.react-server.production.js +0.77% 29.47 kB 29.70 kB +0.28% 8.88 kB 8.90 kB
oss-stable/react/cjs/react.react-server.production.js +0.77% 29.50 kB 29.73 kB +0.29% 8.91 kB 8.93 kB
oss-stable-semver/react/cjs/react.production.js +0.66% 34.37 kB 34.59 kB +0.49% 9.58 kB 9.62 kB
oss-stable/react/cjs/react.production.js +0.66% 34.39 kB 34.62 kB +0.49% 9.61 kB 9.65 kB
oss-experimental/react/cjs/react.react-server.production.js +0.63% 35.59 kB 35.82 kB +0.23% 10.56 kB 10.59 kB
oss-experimental/react/cjs/react.production.js +0.61% 37.00 kB 37.23 kB +0.26% 10.27 kB 10.30 kB
facebook-www/ReactServer-prod.modern.js +0.55% 14.89 kB 14.97 kB = 3.97 kB 3.96 kB
facebook-react-native/react/cjs/React-prod.js +0.46% 17.67 kB 17.76 kB = 4.61 kB 4.59 kB
facebook-react-native/react/cjs/React-profiling.js +0.46% 17.81 kB 17.90 kB = 4.61 kB 4.60 kB
facebook-www/React-prod.modern.js +0.45% 18.35 kB 18.43 kB = 4.71 kB 4.69 kB
facebook-www/React-prod.classic.js +0.44% 18.64 kB 18.72 kB = 4.78 kB 4.76 kB
facebook-www/React-profiling.modern.js +0.44% 18.78 kB 18.86 kB = 4.79 kB 4.77 kB
facebook-www/React-profiling.classic.js +0.43% 19.08 kB 19.16 kB = 4.86 kB 4.85 kB
oss-stable-semver/react/cjs/react.react-server.production.min.js +0.30% 7.00 kB 7.02 kB +0.07% 2.97 kB 2.98 kB
oss-stable/react/cjs/react.react-server.production.min.js +0.30% 7.02 kB 7.04 kB +0.10% 3.00 kB 3.00 kB
oss-stable-semver/react/cjs/react.react-server.development.js +0.30% 77.42 kB 77.65 kB +0.13% 21.43 kB 21.46 kB
oss-stable/react/cjs/react.react-server.development.js +0.30% 77.45 kB 77.68 kB +0.13% 21.46 kB 21.49 kB
facebook-www/ReactServer-dev.modern.js +0.29% 108.59 kB 108.91 kB +0.01% 25.99 kB 25.99 kB
oss-experimental/react/cjs/react.react-server.development.js +0.27% 83.88 kB 84.11 kB +0.11% 23.33 kB 23.35 kB
facebook-react-native/react/cjs/React-dev.js +0.25% 128.87 kB 129.19 kB +0.02% 29.77 kB 29.78 kB
facebook-www/React-dev.modern.js +0.23% 140.93 kB 141.25 kB +0.03% 34.16 kB 34.17 kB
oss-stable-semver/react/cjs/react.development.js +0.23% 101.72 kB 101.95 kB +0.08% 27.22 kB 27.25 kB
oss-stable/react/cjs/react.development.js +0.23% 101.75 kB 101.98 kB +0.09% 27.25 kB 27.28 kB
facebook-www/React-dev.classic.js +0.22% 142.15 kB 142.47 kB +0.02% 34.41 kB 34.42 kB
oss-stable-semver/react/cjs/react.production.min.js +0.22% 8.10 kB 8.12 kB +0.26% 3.10 kB 3.11 kB
oss-stable/react/cjs/react.production.min.js +0.22% 8.12 kB 8.14 kB +0.29% 3.13 kB 3.14 kB
oss-experimental/react/cjs/react.development.js +0.22% 104.29 kB 104.51 kB +0.09% 27.89 kB 27.91 kB
oss-experimental/react/cjs/react.react-server.production.min.js +0.21% 9.04 kB 9.06 kB +0.08% 3.68 kB 3.68 kB
facebook-react-native/react/cjs/JSXRuntime-prod.js +0.20% 1.49 kB 1.49 kB = 0.73 kB 0.71 kB
facebook-react-native/react/cjs/JSXRuntime-profiling.js +0.20% 1.49 kB 1.49 kB = 0.73 kB 0.71 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.92 kB 0.91 kB = 0.57 kB 0.56 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.92 kB 0.91 kB = 0.57 kB 0.56 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.min.js = 0.92 kB 0.91 kB = 0.57 kB 0.56 kB
oss-experimental/react/cjs/react-jsx-runtime.production.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
oss-stable/react/cjs/react-jsx-runtime.production.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.min.js = 0.90 kB 0.89 kB = 0.56 kB 0.55 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Generated by 🚫 dangerJS against 8144840

@acdlite acdlite merged commit 1beb941 into facebook:main Feb 6, 2024
github-actions bot pushed a commit that referenced this pull request Feb 7, 2024
The JSX runtime (both the new one and the classic createElement runtime)
check for reserved props like `key` and `ref` by doing a lookup in a
plain object map with `hasOwnProperty`.

There are only a few reserved props so this inlines the checks instead.

DiffTrain build for [1beb941](1beb941)
@gaearon gaearon deleted the jsx-inline-reserved-prop-checks branch February 8, 2024 16:18
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
The JSX runtime (both the new one and the classic createElement runtime)
check for reserved props like `key` and `ref` by doing a lookup in a
plain object map with `hasOwnProperty`.

There are only a few reserved props so this inlines the checks instead.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
The JSX runtime (both the new one and the classic createElement runtime)
check for reserved props like `key` and `ref` by doing a lookup in a
plain object map with `hasOwnProperty`.

There are only a few reserved props so this inlines the checks instead.

DiffTrain build for commit 1beb941.
# for free to join this conversation on GitHub. Already have an account? # 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.

4 participants