Avoid passing custom stacks to console.error#18685
Avoid passing custom stacks to console.error#18685sebmarkbage merged 5 commits intofacebook:masterfrom
Conversation
These all execute in the right execution context already.
We never pass custom stacks as part of the args anymore.
|
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 3aca0a0:
|
Details of bundled changes.Comparing: 0960b7b...3aca0a0 react
react-native-renderer
react-dom
react-art
react-test-renderer
react-reconciler
ReactDOM: size: 0.0%, gzip: -0.0% React: size: -0.0%, gzip: -0.1% Size changes (stable) |
Details of bundled changes.Comparing: 0960b7b...3aca0a0 react
react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
React: size: -0.0%, gzip: -0.1% Size changes (experimental) |
We print component stacks for every error anyway so this is just duplicate information.
baa1f47 to
3aca0a0
Compare
| (__DEV__ | ||
| ? ' If you meant to render a collection of children, use ' + | ||
| 'an array instead.' + | ||
| '\n in div (at **)' |
There was a problem hiding this comment.
This one will likely regress full-screen errors in CRA and such, where the extra information ("the above error occurred") isn't shown. That's a problem by itself though.
There was a problem hiding this comment.
How do those work today? Ours is using a fork so seems like some missing layering.
If implemented as error boundaries, the information is in the componentStack but I assume it needs a global hook?
There was a problem hiding this comment.
Yeah needs something global. They work today by just catching unhandled errors on window.
|
This looks like a nice change! |
The detection if one of the args contains a stack was broken in the new stack format. Unfortunately the toWarnDev helper that was meant to detect that oversight used the same check.
This stops detecting stacks and instead always appends a stack.
Many of the custom stacks were actually unnecessary because they had the correct execution context already. For the ones that might be called outside the render phase, I set the debug fiber right before calling the warning to set the right context.
That way we never need to pass a custom stack as an argument.