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

Update legacy context warning message #17882

Closed
wants to merge 4 commits into from

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jan 21, 2020

After speaking to @gaearon, we spoke about how we can improve the warning message when using StrictMode with legacy context. Previously, we would output all the offending components and the component stack of the StrictMode, which wasn't that useful in practice. With the changes in this PR, we now output the component stack of the component that most frequently had legacy context warnings in StrictMoode.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 21, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 21, 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.

Latest deployment of this branch, based on commit 32cdbda:

Sandbox Source
kind-flower-k5br1 Configuration

@sizebot
Copy link

sizebot commented Jan 21, 2020

Details of bundled changes.

Comparing: 0c04aca...32cdbda

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.1% 622.44 KB 623.06 KB 131.33 KB 131.52 KB UMD_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 37.83 KB 37.83 KB 9.81 KB 9.8 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% -0.0% 11.66 KB 11.66 KB 3.6 KB 3.6 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% -0.0% 32.37 KB 32.37 KB 8.5 KB 8.49 KB NODE_DEV
react-test-renderer.development.js +0.1% +0.2% 617.71 KB 618.32 KB 130.14 KB 130.34 KB NODE_DEV
ReactTestRenderer-dev.js +0.1% +0.1% 633.53 KB 634.23 KB 130.98 KB 131.17 KB FB_WWW_DEV

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.1% 750.51 KB 751.2 KB 157.79 KB 157.98 KB RN_OSS_DEV
ReactFabric-dev.js +0.1% +0.1% 741.13 KB 741.82 KB 155.58 KB 155.77 KB RN_OSS_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 750.69 KB 751.38 KB 157.89 KB 158.08 KB RN_FB_DEV
ReactFabric-prod.js 0.0% -0.0% 267.1 KB 267.1 KB 45.83 KB 45.83 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% -0.0% 278.23 KB 278.23 KB 47.96 KB 47.96 KB RN_OSS_PROFILING
ReactNativeRenderer-profiling.js 0.0% -0.0% 286.23 KB 286.23 KB 49.3 KB 49.3 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.1% 741.31 KB 742 KB 155.67 KB 155.86 KB RN_FB_DEV
ReactFabric-profiling.js 0.0% -0.0% 278.58 KB 278.58 KB 48.02 KB 48.02 KB RN_FB_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactART-dev.js +0.1% +0.1% 621.94 KB 622.63 KB 128.44 KB 128.63 KB FB_WWW_DEV
ReactART-prod.js 0.0% 0.0% 236.72 KB 236.72 KB 39.91 KB 39.91 KB FB_WWW_PROD
react-art.development.js +0.1% +0.1% 677.57 KB 678.18 KB 145.77 KB 145.96 KB UMD_DEV
react-art.development.js +0.1% +0.1% 608.25 KB 608.86 KB 128.35 KB 128.54 KB NODE_DEV
react-art.production.min.js 0.0% -0.0% 72.29 KB 72.29 KB 21.68 KB 21.68 KB NODE_PROD

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.67 KB 123.67 KB 38.77 KB 38.77 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 137.89 KB 137.89 KB 36.65 KB 36.64 KB UMD_DEV
react-dom-test-utils.development.js 0.0% -0.0% 54.65 KB 54.65 KB 15.36 KB 15.35 KB UMD_DEV
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
react-dom-test-utils.production.min.js 0.0% -0.1% 11.18 KB 11.18 KB 4.15 KB 4.15 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.1% 1.21 KB 1.21 KB 710 B 709 B UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 52.93 KB 52.93 KB 15.04 KB 15.04 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.1% +0.1% 956.28 KB 956.89 KB 214.9 KB 215.09 KB UMD_DEV
react-dom.profiling.min.js 0.0% -0.0% 123.42 KB 123.42 KB 39.57 KB 39.56 KB UMD_PROFILING
react-dom.development.js +0.1% +0.1% 950.34 KB 950.95 KB 213.19 KB 213.41 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 134.93 KB 134.93 KB 35.85 KB 35.85 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 119.79 KB 119.79 KB 37.64 KB 37.64 KB NODE_PROD
ReactDOM-dev.js +0.1% +0.1% 978 KB 978.69 KB 216.12 KB 216.32 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% -0.0% 394.21 KB 394.21 KB 72.07 KB 72.06 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% -0.0% 405.5 KB 405.5 KB 74.22 KB 74.22 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 10.23 KB 10.23 KB 3.47 KB 3.47 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.61 KB 60.61 KB 15.99 KB 15.99 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 4.42 KB 4.42 KB 1.65 KB 1.65 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.97 KB 9.97 KB 3.37 KB 3.37 KB NODE_PROD
ReactDOMServer-dev.js 0.0% -0.0% 139.4 KB 139.4 KB 35.43 KB 35.43 KB FB_WWW_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-persistent.development.js +0.1% +0.2% 606.54 KB 607.16 KB 126.36 KB 126.55 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% -0.0% 72.59 KB 72.59 KB 21.31 KB 21.31 KB NODE_PROD
react-reconciler.development.js +0.1% +0.2% 609.25 KB 609.86 KB 127.52 KB 127.71 KB NODE_DEV
react-reconciler.production.min.js 0.0% -0.0% 75.29 KB 75.29 KB 21.96 KB 21.96 KB NODE_PROD

Size changes (experimental)

Generated by 🚫 dangerJS against 32cdbda

@sizebot
Copy link

sizebot commented Jan 21, 2020

Details of bundled changes.

Comparing: 0c04aca...32cdbda

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-dev.js +0.1% +0.1% 741.12 KB 741.81 KB 155.58 KB 155.76 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% -0.0% 267.09 KB 267.09 KB 45.82 KB 45.82 KB RN_OSS_PROD
ReactNativeRenderer-dev.js +0.1% +0.1% 750.5 KB 751.19 KB 157.79 KB 157.97 KB RN_OSS_DEV
ReactFabric-profiling.js 0.0% -0.0% 278.22 KB 278.22 KB 47.95 KB 47.95 KB RN_OSS_PROFILING

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.2% 609.24 KB 609.85 KB 127.52 KB 127.71 KB NODE_DEV
react-reconciler-persistent.development.js +0.1% +0.2% 606.53 KB 607.14 KB 126.35 KB 126.55 KB NODE_DEV

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.59 KB 60.59 KB 15.99 KB 15.99 KB NODE_DEV
react-dom.profiling.min.js 0.0% -0.0% 119.47 KB 119.47 KB 38.39 KB 38.39 KB UMD_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.96 KB 9.96 KB 3.36 KB 3.36 KB NODE_PROD
react-dom.development.js +0.1% +0.1% 950.32 KB 950.93 KB 213.17 KB 213.38 KB NODE_DEV
react-dom.production.min.js 0.0% -0.0% 115.92 KB 115.92 KB 36.59 KB 36.59 KB NODE_PROD
react-dom.profiling.min.js 0.0% -0.0% 119.69 KB 119.69 KB 37.71 KB 37.71 KB NODE_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-unstable-fizz.browser.development.js 0.0% -0.1% 3.7 KB 3.7 KB 1.49 KB 1.49 KB NODE_DEV
react-dom-test-utils.development.js 0.0% -0.0% 54.64 KB 54.64 KB 15.35 KB 15.35 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1.04 KB 1.04 KB 633 B 632 B NODE_PROD
react-dom-test-utils.production.min.js 0.0% -0.0% 11.17 KB 11.17 KB 4.14 KB 4.14 KB UMD_PROD
react-dom-server.browser.development.js 0.0% -0.0% 133.79 KB 133.79 KB 35.62 KB 35.62 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.94 KB 10.94 KB 4.08 KB 4.08 KB NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 4.4 KB 4.4 KB 1.64 KB 1.64 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.89 KB 60.89 KB 16.06 KB 16.06 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.22 KB 10.22 KB 3.46 KB 3.46 KB UMD_PROD
react-dom.development.js +0.1% +0.1% 956.25 KB 956.87 KB 214.88 KB 215.07 KB UMD_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.1% +0.1% 677.54 KB 678.16 KB 145.76 KB 145.96 KB UMD_DEV
react-art.development.js +0.1% +0.1% 608.22 KB 608.84 KB 128.34 KB 128.53 KB NODE_DEV
react-art.production.min.js 0.0% -0.0% 69.83 KB 69.83 KB 21 KB 21 KB NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer-shallow.development.js 0.0% -0.0% 37.81 KB 37.81 KB 9.8 KB 9.8 KB UMD_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 32.35 KB 32.35 KB 8.49 KB 8.49 KB NODE_DEV
react-test-renderer-shallow.production.min.js 0.0% -0.0% 11.78 KB 11.78 KB 3.7 KB 3.7 KB NODE_PROD
react-test-renderer.development.js +0.1% +0.1% 622.42 KB 623.03 KB 131.32 KB 131.51 KB UMD_DEV
react-test-renderer.production.min.js 0.0% -0.0% 71.96 KB 71.96 KB 21.91 KB 21.91 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.2% 617.68 KB 618.3 KB 130.13 KB 130.33 KB NODE_DEV

Size changes (stable)

Generated by 🚫 dangerJS against 32cdbda

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

I understand your original concern better now. I agree with @bvaughn we shouldn't regress DEV perf here since it's a lot of Fibers. I think replacing didWarnAboutLegacyContext with a Map of Fiber Type => Number of Occurrences makes sense so that we don't have to ask every component's stack.

I think you'll still need a Set to track which types we've flushed the warnings for. So that we don't consider their stacks in next messages.

Does this make sense?

Address more feedback

Address more feedback
@trueadm
Copy link
Contributor Author

trueadm commented Jan 24, 2020

@gaearon I've made those changes, let me know if you're happy with them.

@gaearon
Copy link
Collaborator

gaearon commented Jan 29, 2020

#17922

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.

None yet

5 participants