Skip to content

Refactor Error Dialog Logging#18487

Merged
sebmarkbage merged 3 commits into
facebook:masterfrom
sebmarkbage:errordialog
Apr 4, 2020
Merged

Refactor Error Dialog Logging#18487
sebmarkbage merged 3 commits into
facebook:masterfrom
sebmarkbage:errordialog

Conversation

@sebmarkbage
Copy link
Copy Markdown
Contributor

This stops passing "componentName" and some unnecessary fields to the custom error dialogs. This information is arguably misleading.

This is the only use case we have for getComponentName in PROD other than getting stacks but I'm going to use a different technique for prod stacks which will let me get rid of it in prod if I just remove this.

You'd think that this wouldn't affect the prod bundle but the indirect way this is wired up means that we include the code that should only be used by FB forks in the npm bundles as unused code. So I cleaned that up as well.

componentName is not necessary and is misleading when the error is caused
elsewhere in the stack. The stack is sufficient.

The many error boundary fields are unnecessary because they can be inferred
by the boundary itself.
If it was possible, it would've been done in createCapturedValue.
@sebmarkbage sebmarkbage requested review from bvaughn and gaearon April 4, 2020 01:20
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 4, 2020
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Apr 4, 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 c2470ce:

Sandbox Source
intelligent-hellman-u62y7 Configuration

const capturedError = {
componentStack: errorInfo.stack !== null ? errorInfo.stack : '',
error: errorInfo.value,
errorBoundary:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you can drop this field. https://github.com/facebook/react-native/blob/21733641a8f1da6d6721618a0180509ab2b080a1/Libraries/Core/ReactFiberErrorDialog.js#L31

And maybe remove things from the type on their end.

@sizebot
Copy link
Copy Markdown

sizebot commented Apr 4, 2020

Details of bundled changes.

Comparing: 59fd09c...c2470ce

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.production.min.js -0.1% -0.1% 118.87 KB 118.76 KB 37.28 KB 37.24 KB NODE_PROD
react-dom-test-utils.development.js 0.0% -0.0% 61.81 KB 61.81 KB 16.37 KB 16.37 KB UMD_DEV
ReactDOMTesting-profiling.js -0.1% -0.1% 403.12 KB 402.69 KB 73 KB 72.96 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% -0.0% 19.46 KB 19.46 KB 7.3 KB 7.3 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 4.81 KB 4.81 KB 1.61 KB 1.61 KB UMD_DEV
react-dom.profiling.min.js -0.1% -0.1% 122.72 KB 122.61 KB 38.41 KB 38.38 KB NODE_PROFILING
react-dom-server.node.development.js 0.0% -0.0% 128.22 KB 128.22 KB 34.32 KB 34.32 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 19.87 KB 19.87 KB 7.45 KB 7.44 KB NODE_PROD
ReactDOMForked-dev.js -0.0% -0.1% 994.24 KB 993.77 KB 220.61 KB 220.5 KB FB_WWW_DEV
ReactDOMForked-prod.js -0.1% -0.1% 418.73 KB 418.31 KB 75.21 KB 75.17 KB FB_WWW_PROD
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 5.08 KB 5.08 KB 1.67 KB 1.67 KB NODE_DEV
react-dom.development.js -0.0% -0.0% 895.84 KB 895.59 KB 196.65 KB 196.62 KB UMD_DEV
ReactDOMForked-profiling.js -0.1% -0.1% 429.61 KB 429.19 KB 77.1 KB 77.02 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 133.89 KB 133.89 KB 34.5 KB 34.5 KB UMD_DEV
react-dom.production.min.js -0.1% -0.2% 118.76 KB 118.65 KB 38.06 KB 38 KB UMD_PROD
react-dom-server.browser.production.min.js 0.0% -0.0% 19.55 KB 19.55 KB 7.33 KB 7.32 KB UMD_PROD
react-dom.profiling.min.js -0.1% -0.1% 122.47 KB 122.37 KB 39.23 KB 39.2 KB UMD_PROFILING
ReactDOMTesting-dev.js -0.0% -0.1% 947.31 KB 946.84 KB 210.86 KB 210.7 KB FB_WWW_DEV
react-dom.development.js -0.0% -0.0% 852.85 KB 852.62 KB 194.25 KB 194.23 KB NODE_DEV
ReactDOMTesting-prod.js -0.1% -0.1% 403.12 KB 402.69 KB 73 KB 72.96 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% -0.0% 127 KB 127 KB 34.06 KB 34.06 KB NODE_DEV
ReactDOM-dev.js -0.0% -0.1% 994.24 KB 993.77 KB 220.61 KB 220.5 KB FB_WWW_DEV
ReactDOMServer-dev.js 0.0% -0.0% 136.77 KB 136.77 KB 34.86 KB 34.86 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.1% 418.73 KB 418.31 KB 75.21 KB 75.17 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% -0.0% 57.18 KB 57.18 KB 15.73 KB 15.73 KB NODE_DEV
ReactDOM-profiling.js -0.1% -0.1% 429.61 KB 429.19 KB 77.1 KB 77.02 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 12.22 KB 12.22 KB 4.5 KB 4.5 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 56.1 KB 56.1 KB 13.84 KB 13.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.98 KB 9.98 KB 3.36 KB 3.35 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 53.2 KB 53.2 KB 13.64 KB 13.64 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.1% 9.73 KB 9.73 KB 3.25 KB 3.24 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js -0.1% -0.1% 648.42 KB 647.93 KB 139.29 KB 139.14 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.2% -0.2% 270.43 KB 269.99 KB 46.53 KB 46.44 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.2% -0.1% 282.34 KB 281.9 KB 48.73 KB 48.67 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.1% -0.1% 630.13 KB 629.64 KB 134.86 KB 134.73 KB RN_OSS_DEV
ReactFabric-prod.js -0.2% -0.2% 262.42 KB 261.97 KB 45.02 KB 44.92 KB RN_OSS_PROD
ReactFabric-profiling.js -0.2% -0.2% 274.32 KB 273.88 KB 47.24 KB 47.14 KB RN_OSS_PROFILING

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.0% -0.1% 624.73 KB 624.48 KB 131.84 KB 131.77 KB UMD_DEV
react-art.production.min.js -0.1% -0.0% 106.71 KB 106.6 KB 32.32 KB 32.31 KB UMD_PROD
react-art.development.js -0.0% -0.0% 529.5 KB 529.27 KB 114.16 KB 114.11 KB NODE_DEV
react-art.production.min.js -0.2% -0.3% 71.75 KB 71.64 KB 21.58 KB 21.52 KB NODE_PROD
ReactART-dev.js -0.1% -0.1% 591.05 KB 590.58 KB 123.95 KB 123.81 KB FB_WWW_DEV
ReactART-prod.js -0.2% -0.2% 248.27 KB 247.84 KB 41.95 KB 41.88 KB FB_WWW_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -0.0% -0.1% 562.49 KB 562.24 KB 117.05 KB 116.98 KB UMD_DEV
react-test-renderer.production.min.js -0.1% -0.2% 73.73 KB 73.62 KB 22.41 KB 22.36 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% -0.0% 38.62 KB 38.62 KB 9.39 KB 9.39 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% -0.1% 12.73 KB 12.73 KB 3.97 KB 3.96 KB UMD_PROD
react-test-renderer.development.js -0.0% -0.0% 536.33 KB 536.1 KB 115.62 KB 115.56 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.2% 73.56 KB 73.45 KB 22.1 KB 22.06 KB NODE_PROD
ReactTestRenderer-dev.js -0.1% -0.1% 570.25 KB 569.78 KB 120.28 KB 120.16 KB FB_WWW_DEV

Size changes (stable)

Generated by 🚫 dangerJS against c2470ce

@sizebot
Copy link
Copy Markdown

sizebot commented Apr 4, 2020

Details of bundled changes.

Comparing: 59fd09c...c2470ce

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -0.2% -0.2% 270.44 KB 270 KB 46.53 KB 46.45 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.2% -0.1% 282.35 KB 281.91 KB 48.74 KB 48.67 KB RN_OSS_PROFILING
ReactFabric-prod.js -0.2% -0.2% 262.43 KB 261.99 KB 45.03 KB 44.92 KB RN_OSS_PROD
ReactFabric-profiling.js -0.2% -0.2% 274.33 KB 273.89 KB 47.25 KB 47.15 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.1% -0.1% 632.56 KB 632.06 KB 135.18 KB 135.05 KB RN_FB_DEV
ReactFabric-prod.js -0.2% -0.2% 262.58 KB 262.14 KB 45.06 KB 44.96 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.1% -0.1% 648.43 KB 647.94 KB 139.3 KB 139.14 KB RN_OSS_DEV
ReactFabric-profiling.js -0.2% -0.2% 274.48 KB 274.04 KB 47.28 KB 47.18 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js -0.1% -0.1% 650.84 KB 650.35 KB 139.63 KB 139.47 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.2% -0.2% 270.59 KB 270.15 KB 46.56 KB 46.48 KB RN_FB_PROD
ReactNativeRenderer-profiling.js -0.2% -0.1% 282.49 KB 282.05 KB 48.77 KB 48.7 KB RN_FB_PROFILING
ReactFabric-dev.js -0.1% -0.1% 630.14 KB 629.65 KB 134.87 KB 134.74 KB RN_OSS_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js -0.1% -0.1% 570.26 KB 569.79 KB 120.29 KB 120.17 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 38.63 KB 38.63 KB 9.4 KB 9.39 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% -0.1% 12.74 KB 12.74 KB 3.97 KB 3.97 KB UMD_PROD
react-test-renderer.development.js -0.0% -0.1% 562.52 KB 562.27 KB 117.07 KB 116.99 KB UMD_DEV
react-test-renderer.production.min.js -0.1% -0.2% 73.76 KB 73.65 KB 22.43 KB 22.38 KB UMD_PROD
react-test-renderer.development.js -0.0% -0.0% 536.36 KB 536.13 KB 115.63 KB 115.58 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.2% 73.59 KB 73.48 KB 22.12 KB 22.08 KB NODE_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.development.js 0.0% -0.0% 135.47 KB 135.47 KB 34.7 KB 34.7 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.01 KB 20.01 KB 7.41 KB 7.41 KB UMD_PROD
react-dom.profiling.min.js -0.1% -0.1% 126.99 KB 126.89 KB 39.63 KB 39.61 KB NODE_PROFILING
ReactDOM-dev.js -0.0% -0.1% 966.36 KB 965.89 KB 214.23 KB 214.11 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.1% 405.67 KB 405.25 KB 73.2 KB 73.15 KB FB_WWW_PROD
ReactDOM-profiling.js -0.1% -0.1% 416.49 KB 416.06 KB 75.03 KB 74.96 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% -0.0% 61.82 KB 61.82 KB 16.38 KB 16.38 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 12.37 KB 12.37 KB 4.58 KB 4.58 KB UMD_PROD
ReactDOMTesting-dev.js -0.1% -0.1% 920.76 KB 920.3 KB 205.02 KB 204.89 KB FB_WWW_DEV
ReactDOMTesting-prod.js -0.1% -0.1% 391.14 KB 390.71 KB 71.11 KB 71.07 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% -0.0% 57.19 KB 57.19 KB 15.74 KB 15.74 KB NODE_DEV
ReactDOMTesting-profiling.js -0.1% -0.1% 391.14 KB 390.71 KB 71.11 KB 71.07 KB FB_WWW_PROFILING
react-dom-server.node.development.js 0.0% -0.0% 129.73 KB 129.73 KB 34.53 KB 34.53 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% -0.0% 20.33 KB 20.33 KB 7.53 KB 7.53 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 128.51 KB 128.51 KB 34.27 KB 34.27 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 19.92 KB 19.92 KB 7.38 KB 7.38 KB NODE_PROD
react-dom.development.js -0.0% -0.0% 925.67 KB 925.42 KB 201.95 KB 201.93 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 56.11 KB 56.11 KB 13.85 KB 13.85 KB UMD_DEV
react-dom.production.min.js -0.1% -0.1% 122.84 KB 122.73 KB 39.14 KB 39.11 KB UMD_PROD
ReactDOMForked-dev.js -0.0% -0.1% 966.36 KB 965.89 KB 214.23 KB 214.11 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10 KB 10 KB 3.36 KB 3.36 KB UMD_PROD
ReactDOMServer-dev.js 0.0% -0.0% 135.92 KB 135.92 KB 34.73 KB 34.73 KB FB_WWW_DEV
react-dom.profiling.min.js -0.1% -0.1% 126.66 KB 126.55 KB 40.39 KB 40.36 KB UMD_PROFILING
ReactDOMForked-prod.js -0.1% -0.1% 405.67 KB 405.25 KB 73.2 KB 73.15 KB FB_WWW_PROD
react-dom.development.js -0.0% -0.0% 881.44 KB 881.21 KB 199.48 KB 199.46 KB NODE_DEV
ReactDOMForked-profiling.js -0.1% -0.1% 416.49 KB 416.06 KB 75.03 KB 74.96 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 53.21 KB 53.21 KB 13.65 KB 13.65 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% -0.1% 5.09 KB 5.09 KB 1.68 KB 1.68 KB NODE_DEV
react-dom.production.min.js -0.1% -0.1% 123.01 KB 122.91 KB 38.4 KB 38.37 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.75 KB 9.75 KB 3.25 KB 3.25 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.0% -0.1% 645 KB 644.75 KB 135.52 KB 135.45 KB UMD_DEV
react-art.production.min.js -0.1% -0.1% 109.32 KB 109.21 KB 33.02 KB 32.99 KB UMD_PROD
react-art.development.js -0.0% -0.0% 548.97 KB 548.74 KB 117.91 KB 117.86 KB NODE_DEV
react-art.production.min.js -0.1% -0.2% 74.31 KB 74.2 KB 22.22 KB 22.17 KB NODE_PROD
ReactART-dev.js -0.1% -0.1% 580.98 KB 580.52 KB 121.97 KB 121.81 KB FB_WWW_DEV
ReactART-prod.js -0.2% -0.2% 240.67 KB 240.24 KB 40.67 KB 40.59 KB FB_WWW_PROD

ReactDOM: size: 0.0%, gzip: -0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against c2470ce

Copy link
Copy Markdown
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.

Looks good. Verify it on WWW (both sites)?

js1 upgrade react --pr 18487

This avoids needing this in the npm published case.
@sebmarkbage sebmarkbage merged commit 5022fdf into facebook:master Apr 4, 2020
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Apr 4, 2020
Summary:
Removed in facebook/react#18487

Changelog: [React Core] Logging changes

Reviewed By: gaearon

Differential Revision: D20853086

fbshipit-source-id: 4b0002f21269f415769a2ac8305ba5750245f7d1
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