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

Feature Flag for React.jsx' "spreading a key to jsx" warning #18074

Merged

Conversation

threepointone
Copy link
Contributor

@threepointone threepointone commented Feb 19, 2020

Adds a feature flag for when React.jsx warns you about spreading a key into jsx. It's false for all builds, except as a dynamic flag for fb/www.

I also included the component name in the warning.

@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Feb 19, 2020
@threepointone threepointone changed the title Feature Flag for React.jsx` "spreading a key to jsx" warning Feature Flag for React.jsx' "spreading a key to jsx" warning Feb 19, 2020
@sizebot
Copy link

sizebot commented Feb 19, 2020

Details of bundled changes.

Comparing: 4912ba3...96c85c6

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js +0.4% +0.6% 115.28 KB 115.78 KB 29.56 KB 29.74 KB UMD_DEV
react.production.min.js 0.0% 0.0% 12.67 KB 12.67 KB 4.95 KB 4.95 KB UMD_PROD
react.profiling.min.js 0.0% 0.0% 16.2 KB 16.2 KB 6.05 KB 6.05 KB UMD_PROFILING
react.development.js +0.7% +0.9% 74.79 KB 75.29 KB 19.85 KB 20.03 KB NODE_DEV
react.production.min.js 0.0% 0.0% 6.96 KB 6.96 KB 2.86 KB 2.86 KB NODE_PROD
React-dev.js +0.2% +0.2% 74.39 KB 74.55 KB 18.89 KB 18.93 KB FB_WWW_DEV
React-prod.js 0.0% 0.0% 18.28 KB 18.28 KB 4.68 KB 4.68 KB FB_WWW_PROD
React-profiling.js 0.0% 0.0% 18.28 KB 18.28 KB 4.68 KB 4.68 KB FB_WWW_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js 0.0% 0.0% 123.72 KB 123.72 KB 38.72 KB 38.72 KB NODE_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.88 KB 3.88 KB 1.55 KB 1.55 KB UMD_DEV
ReactDOM-dev.js 0.0% 0.0% 989.64 KB 989.71 KB 218.22 KB 218.24 KB FB_WWW_DEV
react-dom-test-utils.development.js +0.7% +0.9% 55.98 KB 56.36 KB 15.78 KB 15.93 KB UMD_DEV
react-dom-server.browser.development.js +0.3% +0.4% 139.77 KB 140.16 KB 37.11 KB 37.25 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 11.21 KB 11.21 KB 4.16 KB 4.17 KB UMD_PROD
react-dom-test-utils.development.js +0.7% +1.0% 54.25 KB 54.64 KB 15.47 KB 15.61 KB NODE_DEV
react-dom-server.browser.development.js +0.3% +0.4% 135.71 KB 136.09 KB 36.09 KB 36.23 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.99 KB 10.99 KB 4.1 KB 4.1 KB NODE_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 20.39 KB 20.39 KB 7.47 KB 7.47 KB NODE_PROD
react-dom.development.js 0.0% +0.1% 969.61 KB 970 KB 217.85 KB 218.01 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 58.73 KB 58.73 KB 15.36 KB 15.36 KB UMD_DEV
react-dom.production.min.js 0.0% 0.0% 119.87 KB 119.87 KB 38.33 KB 38.33 KB UMD_PROD
ReactTestUtils-dev.js +0.1% +0.2% 52.86 KB 52.93 KB 14.39 KB 14.41 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.25 KB 10.25 KB 3.47 KB 3.48 KB UMD_PROD
ReactDOMServer-dev.js 0.0% +0.1% 140.47 KB 140.54 KB 35.55 KB 35.57 KB FB_WWW_DEV
react-dom.profiling.min.js 0.0% 0.0% 123.5 KB 123.5 KB 39.5 KB 39.5 KB UMD_PROFILING
ReactDOMServer-prod.js 0.0% 0.0% 48.27 KB 48.27 KB 11.02 KB 11.02 KB FB_WWW_PROD
react-dom.development.js 0.0% +0.1% 963.69 KB 964.08 KB 216.22 KB 216.38 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 58.43 KB 58.43 KB 15.28 KB 15.28 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 119.93 KB 119.93 KB 37.57 KB 37.57 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 9.99 KB 9.99 KB 3.38 KB 3.38 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 697 B 698 B NODE_PROD
ReactDOM-prod.js 0.0% 0.0% 372.98 KB 372.98 KB 67.77 KB 67.77 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% 0.0% 384.28 KB 384.28 KB 69.84 KB 69.84 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.71 KB 3.71 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-testing.development.js 0.0% 0.0% 966.45 KB 966.45 KB 216.69 KB 216.69 KB UMD_DEV
react-dom-testing.production.min.js 0.0% 0.0% 117.52 KB 117.52 KB 37.86 KB 37.86 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 989.14 KB 989.15 KB 218.09 KB 218.1 KB FB_WWW_DEV
react-dom-testing.profiling.min.js 0.0% 0.0% 121.04 KB 121.04 KB 39.01 KB 39.01 KB UMD_PROFILING
react-dom-testing.development.js 0.0% 0.0% 960.53 KB 960.53 KB 215.05 KB 215.05 KB NODE_DEV
react-dom-server.node.development.js +0.3% +0.4% 136.82 KB 137.2 KB 36.32 KB 36.46 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 20.79 KB 20.79 KB 7.62 KB 7.62 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js 0.0% 0.0% 615.41 KB 615.41 KB 128.53 KB 128.53 KB NODE_DEV
react-reconciler-reflection.development.js +1.9% +2.3% 20.54 KB 20.92 KB 6.76 KB 6.92 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% 0.0% 73.76 KB 73.76 KB 21.78 KB 21.79 KB NODE_PROD
react-reconciler.development.js +0.1% +0.1% 619.21 KB 619.6 KB 130.04 KB 130.2 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 76.52 KB 76.52 KB 22.44 KB 22.44 KB NODE_PROD

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler-tracing.development.js +3.1% +5.0% 12.57 KB 12.95 KB 3.29 KB 3.46 KB NODE_DEV
scheduler-tracing.production.min.js 0.0% 🔺+1.0% 741 B 741 B 391 B 395 B NODE_PROD
scheduler-unstable_mock.development.js 0.0% 0.0% 22.66 KB 22.66 KB 5.41 KB 5.41 KB UMD_DEV
scheduler-tracing.profiling.min.js 0.0% +0.2% 3.26 KB 3.26 KB 1000 B 1002 B NODE_PROFILING
scheduler-unstable_mock.production.min.js 0.0% 0.0% 4.72 KB 4.72 KB 1.98 KB 1.98 KB UMD_PROD
SchedulerTracing-dev.js +0.7% +1.0% 10.13 KB 10.2 KB 2.19 KB 2.21 KB FB_WWW_DEV
scheduler-unstable_mock.development.js 0.0% 0.0% 22.47 KB 22.47 KB 5.35 KB 5.35 KB NODE_DEV
scheduler-unstable_mock.production.min.js 0.0% 🔺+0.1% 4.71 KB 4.71 KB 1.91 KB 1.91 KB NODE_PROD
scheduler.development.js 0.0% 0.0% 25.29 KB 25.29 KB 6.48 KB 6.48 KB NODE_DEV
scheduler.production.min.js 0.0% 0.0% 5 KB 5 KB 2.01 KB 2.01 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js 0.0% 0.0% 625.45 KB 625.52 KB 129.19 KB 129.21 KB FB_WWW_DEV
react-art.development.js +0.1% +0.1% 682.43 KB 682.81 KB 146.87 KB 147.02 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 107.54 KB 107.54 KB 32.52 KB 32.53 KB UMD_PROD
react-art.development.js +0.1% +0.1% 613.1 KB 613.48 KB 129.46 KB 129.62 KB NODE_DEV
react-art.production.min.js 0.0% 0.0% 72.5 KB 72.5 KB 21.66 KB 21.66 KB NODE_PROD
ReactART-prod.js 0.0% 0.0% 233.07 KB 233.07 KB 39.28 KB 39.28 KB FB_WWW_PROD

React: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against 96c85c6

@threepointone threepointone force-pushed the jsx-spread-warning-feature-flag branch from f15ee76 to 6c60013 Compare February 19, 2020 13:18
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@sizebot
Copy link

sizebot commented Feb 19, 2020

Details of bundled changes.

Comparing: 4912ba3...96c85c6

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js +0.4% +0.6% 115.26 KB 115.76 KB 29.56 KB 29.74 KB UMD_DEV
react.production.min.js 0.0% 0.0% 12.33 KB 12.33 KB 4.84 KB 4.84 KB UMD_PROD
react.profiling.min.js 0.0% 0.0% 15.85 KB 15.85 KB 5.95 KB 5.95 KB UMD_PROFILING
react.development.js +0.7% +0.9% 74.77 KB 75.27 KB 19.84 KB 20.02 KB NODE_DEV
react.production.min.js 0.0% 0.0% 6.54 KB 6.54 KB 2.72 KB 2.72 KB NODE_PROD
React-dev.js +0.2% +0.2% 74.38 KB 74.54 KB 18.89 KB 18.93 KB FB_WWW_DEV
React-prod.js 0.0% 0.0% 18.17 KB 18.17 KB 4.69 KB 4.69 KB FB_WWW_PROD
React-profiling.js 0.0% 0.0% 18.17 KB 18.17 KB 4.69 KB 4.69 KB FB_WWW_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-testing.production.min.js 0.0% -0.0% 117.07 KB 117.07 KB 37.04 KB 37.03 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 58.72 KB 58.72 KB 15.35 KB 15.35 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.24 KB 10.24 KB 3.47 KB 3.47 KB UMD_PROD
ReactTestUtils-dev.js +0.1% +0.2% 52.86 KB 52.93 KB 14.38 KB 14.41 KB FB_WWW_DEV
react-dom.development.js 0.0% +0.1% 969.59 KB 969.97 KB 217.83 KB 218 KB UMD_DEV
react-dom-server.browser.development.js +0.3% +0.4% 139.75 KB 140.13 KB 37.1 KB 37.25 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 689 B 690 B NODE_PROD
react-dom.production.min.js 0.0% 0.0% 115.96 KB 115.96 KB 37.21 KB 37.21 KB UMD_PROD
ReactDOMTesting-dev.js 0.0% 0.0% 989.14 KB 989.14 KB 218.08 KB 218.08 KB FB_WWW_DEV
react-dom.development.js 0.0% +0.1% 963.67 KB 964.06 KB 216.2 KB 216.37 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 383.18 KB 383.18 KB 69.65 KB 69.65 KB FB_WWW_PROD
react-dom-server.browser.development.js +0.3% +0.4% 135.68 KB 136.07 KB 36.08 KB 36.23 KB NODE_DEV
react-dom.production.min.js 0.0% 0.0% 115.99 KB 115.99 KB 36.55 KB 36.55 KB NODE_PROD
react-dom-testing.development.js 0.0% 0.0% 966.42 KB 966.42 KB 216.68 KB 216.68 KB UMD_DEV
ReactDOMTesting-profiling.js 0.0% 0.0% 383.18 KB 383.18 KB 69.65 KB 69.65 KB FB_WWW_PROFILING
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.87 KB 3.87 KB 1.54 KB 1.54 KB UMD_DEV
react-dom.profiling.min.js 0.0% -0.0% 119.66 KB 119.66 KB 37.64 KB 37.64 KB NODE_PROFILING
ReactDOM-dev.js 0.0% 0.0% 990.59 KB 990.66 KB 218.53 KB 218.56 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% 0.0% 140.46 KB 140.53 KB 35.55 KB 35.57 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 396.61 KB 396.61 KB 72.1 KB 72.1 KB FB_WWW_PROD
react-dom-testing.development.js 0.0% 0.0% 960.51 KB 960.51 KB 215.04 KB 215.04 KB NODE_DEV
ReactDOMServer-prod.js 0.0% 0.0% 48.98 KB 48.98 KB 11.17 KB 11.18 KB FB_WWW_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.7 KB 3.7 KB 1.49 KB 1.5 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 58.42 KB 58.42 KB 15.28 KB 15.28 KB NODE_DEV
react-dom-test-utils.development.js +0.7% +0.9% 55.97 KB 56.35 KB 15.78 KB 15.92 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 9.98 KB 9.98 KB 3.37 KB 3.37 KB NODE_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 11.2 KB 11.2 KB 4.16 KB 4.16 KB UMD_PROD
react-dom-test-utils.development.js +0.7% +1.0% 54.24 KB 54.62 KB 15.46 KB 15.61 KB NODE_DEV
react-dom-server.node.development.js +0.3% +0.4% 136.79 KB 137.18 KB 36.31 KB 36.46 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.97 KB 10.97 KB 4.09 KB 4.09 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.production.min.js 0.0% 0.0% 69.99 KB 69.99 KB 20.99 KB 20.99 KB NODE_PROD
react-art.development.js +0.1% +0.1% 682.4 KB 682.79 KB 146.87 KB 147.01 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 104.98 KB 104.98 KB 31.84 KB 31.84 KB UMD_PROD
react-art.development.js +0.1% +0.1% 613.08 KB 613.46 KB 129.45 KB 129.61 KB NODE_DEV
ReactART-dev.js 0.0% 0.0% 625.44 KB 625.51 KB 129.18 KB 129.21 KB FB_WWW_DEV
ReactART-prod.js 0.0% 0.0% 240.58 KB 240.58 KB 40.5 KB 40.5 KB FB_WWW_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js 0.0% 0.0% 615.39 KB 615.39 KB 128.52 KB 128.52 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% 0.0% 73.75 KB 73.75 KB 21.78 KB 21.78 KB NODE_PROD
react-reconciler.development.js +0.1% +0.1% 619.2 KB 619.59 KB 130.04 KB 130.2 KB NODE_DEV
react-reconciler-reflection.development.js +1.9% +2.3% 20.52 KB 20.91 KB 6.76 KB 6.91 KB NODE_DEV

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
SchedulerTracing-dev.js +0.7% +0.9% 10.13 KB 10.2 KB 2.19 KB 2.21 KB FB_WWW_DEV
scheduler.development.js 0.0% 0.0% 25.28 KB 25.28 KB 6.48 KB 6.48 KB NODE_DEV
scheduler.production.min.js 0.0% 0.0% 4.99 KB 4.99 KB 2 KB 2 KB NODE_PROD
scheduler-unstable_mock.development.js 0.0% 0.0% 22.65 KB 22.65 KB 5.4 KB 5.4 KB UMD_DEV
scheduler-unstable_mock.production.min.js 0.0% 🔺+0.1% 4.71 KB 4.71 KB 1.97 KB 1.97 KB UMD_PROD
scheduler-unstable_mock.development.js 0.0% 0.0% 22.46 KB 22.46 KB 5.35 KB 5.35 KB NODE_DEV
scheduler-tracing.development.js +3.1% +5.1% 12.55 KB 12.94 KB 3.29 KB 3.46 KB NODE_DEV
scheduler-unstable_mock.production.min.js 0.0% 🔺+0.1% 4.7 KB 4.7 KB 1.9 KB 1.9 KB NODE_PROD
scheduler-tracing.profiling.min.js 0.0% +0.2% 3.25 KB 3.25 KB 991 B 993 B NODE_PROFILING

ReactDOM: size: 0.0%, gzip: 🔺+0.1%

React: size: 0.0%, gzip: 0.0%

Size changes (stable)

Generated by 🚫 dangerJS against 96c85c6

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 19, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@@ -365,13 +369,20 @@ export function jsxWithValidation(
}
}

if (hasOwnProperty.call(props, 'key')) {
Copy link
Contributor Author

@threepointone threepointone Feb 19, 2020

Choose a reason for hiding this comment

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

moved this inside the __DEV__ block. It wasn't being DCEed, so that gets us a few bytes back too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait, wasn’t this whole file supposed to be dev only? Are you saying this function is used in prod?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh hmm you're right. I only glanced at sizebot, probably not relevant.

@threepointone threepointone force-pushed the jsx-spread-warning-feature-flag branch 2 times, most recently from 0643ad6 to 513ed10 Compare February 19, 2020 14:35
@threepointone threepointone force-pushed the jsx-spread-warning-feature-flag branch from 513ed10 to 78f69d0 Compare February 19, 2020 14:54
Adds a feature flag for when React.jsx warns you about spreading a key into jsx. It's false for all builds, except as a dynamic flag for fb/www.

I also included the component name in the warning.
@threepointone threepointone force-pushed the jsx-spread-warning-feature-flag branch from 43bd414 to 96c85c6 Compare February 19, 2020 15:53
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.

4 participants