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

Set the current fiber to the source of the error during error reporting #29044

Merged
merged 1 commit into from
May 23, 2024

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented May 10, 2024

This lets us expose the component stack to the error reporting that happens here as console.error patching. Now if you just call console.error in the error handlers it'll get the component stack added to the end by React DevTools.

However, unfortunately this happens a little too late so the Fiber will be disconnected with its .return pointer set to null already. So it'll be too late to extract a parent component stack from but you can at least get the stack from source to error boundary. To work around this I manually add the parent component stack in our default handlers when owner stacks are off. We could potentially fix this but you can also just include it yourself if you're calling console.error and it's not a problem for owner stacks.

This is not a problem for owner stacks because we'll still have those and so for those just calling console.error just works. However, the main feature is that by letting React add them, we can switch to using native error stacks when available.

@sebmarkbage sebmarkbage requested a review from eps1lon May 10, 2024 19:40
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels May 10, 2024
@react-sizebot
Copy link

react-sizebot commented May 10, 2024

Comparing: 2e3e6a9...0f2b634

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.js = 6.66 kB 6.66 kB +0.05% 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.89 kB 495.89 kB = 88.79 kB 88.79 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB +0.11% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 500.69 kB 500.69 kB = 89.47 kB 89.47 kB
facebook-www/ReactDOM-prod.classic.js = 593.45 kB 593.45 kB = 104.41 kB 104.41 kB
facebook-www/ReactDOM-prod.modern.js = 569.83 kB 569.83 kB = 100.80 kB 100.80 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-experimental/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-stable-semver/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-stable/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-experimental/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-stable-semver/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-stable/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-experimental/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-stable-semver/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-stable/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
test_utils/ReactAllWarnings.js Deleted 64.35 kB 0.00 kB Deleted 16.05 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-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js +19.24% 1.99 kB 2.37 kB +12.75% 1.04 kB 1.18 kB
oss-experimental/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-stable-semver/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-stable/react/cjs/react-compiler-runtime.development.js +14.75% 2.60 kB 2.98 kB +10.41% 1.31 kB 1.44 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store.development.js +14.52% 2.64 kB 3.02 kB +10.54% 1.23 kB 1.36 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +4.99% 7.67 kB 8.06 kB +3.85% 3.06 kB 3.18 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +4.64% 8.26 kB 8.64 kB +3.79% 3.16 kB 3.28 kB
oss-experimental/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-stable-semver/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-stable/react-cache/cjs/react-cache.development.js +4.48% 8.55 kB 8.93 kB +4.14% 2.88 kB 2.99 kB
oss-experimental/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-stable-semver/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-stable/react-dom/cjs/react-dom.react-server.development.js +2.31% 16.55 kB 16.93 kB +3.41% 3.61 kB 3.74 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js +2.05% 18.70 kB 19.09 kB +2.24% 5.36 kB 5.48 kB
oss-stable-semver/react-dom/cjs/react-dom.development.js +1.57% 24.33 kB 24.72 kB +1.93% 6.22 kB 6.34 kB
oss-stable/react-dom/cjs/react-dom.development.js +1.57% 24.36 kB 24.74 kB +1.88% 6.24 kB 6.36 kB
oss-experimental/react-dom/cjs/react-dom.development.js +1.57% 24.37 kB 24.75 kB +1.87% 6.25 kB 6.36 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.development.js +0.92% 41.43 kB 41.81 kB +0.89% 12.53 kB 12.64 kB
oss-stable/react/cjs/react-jsx-dev-runtime.development.js +0.92% 41.43 kB 41.81 kB +0.89% 12.53 kB 12.64 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js +0.91% 42.23 kB 42.62 kB +0.90% 12.77 kB 12.88 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer.development.js +0.90% 42.45 kB 42.83 kB +1.16% 9.66 kB 9.77 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer.development.js +0.90% 42.45 kB 42.83 kB +1.16% 9.66 kB 9.77 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer.development.js +0.90% 42.45 kB 42.83 kB +1.16% 9.66 kB 9.77 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js +0.90% 42.58 kB 42.96 kB +0.89% 12.72 kB 12.83 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.90% 42.58 kB 42.96 kB +1.16% 9.68 kB 9.79 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.90% 42.58 kB 42.96 kB +1.16% 9.68 kB 9.79 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js +0.90% 42.58 kB 42.96 kB +1.16% 9.68 kB 9.79 kB
oss-stable-semver/react/cjs/react-jsx-runtime.development.js +0.90% 42.66 kB 43.04 kB +0.87% 12.87 kB 12.99 kB
oss-stable/react/cjs/react-jsx-runtime.development.js +0.90% 42.66 kB 43.04 kB +0.87% 12.87 kB 12.99 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.development.js +0.89% 43.07 kB 43.45 kB +0.87% 13.00 kB 13.11 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.development.js +0.89% 43.07 kB 43.45 kB +0.87% 13.00 kB 13.11 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.react-server.development.js +0.89% 43.07 kB 43.46 kB +0.88% 13.00 kB 13.11 kB
oss-stable/react/cjs/react-jsx-dev-runtime.react-server.development.js +0.89% 43.07 kB 43.46 kB +0.88% 13.00 kB 13.11 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js +0.88% 43.47 kB 43.85 kB +0.88% 13.13 kB 13.24 kB
oss-experimental/react/cjs/react-jsx-runtime.development.js +0.87% 43.81 kB 44.19 kB +0.87% 13.07 kB 13.18 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.development.js +0.87% 44.21 kB 44.60 kB +0.88% 13.20 kB 13.31 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.react-server.development.js +0.87% 44.22 kB 44.60 kB +0.88% 13.20 kB 13.31 kB
oss-stable-semver/react/cjs/react.react-server.development.js +0.55% 69.07 kB 69.45 kB +0.61% 19.31 kB 19.43 kB
oss-stable/react/cjs/react.react-server.development.js +0.55% 69.09 kB 69.47 kB +0.63% 19.33 kB 19.46 kB
oss-experimental/react/cjs/react.react-server.development.js +0.50% 75.89 kB 76.27 kB +0.60% 21.12 kB 21.24 kB
oss-stable-semver/react-client/cjs/react-client-flight.development.js +0.42% 90.29 kB 90.67 kB +0.58% 20.02 kB 20.14 kB
oss-stable/react-client/cjs/react-client-flight.development.js +0.42% 90.29 kB 90.67 kB +0.58% 20.02 kB 20.14 kB
oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.42% 90.30 kB 90.69 kB +0.63% 19.73 kB 19.86 kB
oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.42% 90.30 kB 90.69 kB +0.63% 19.73 kB 19.86 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.42% 90.54 kB 90.93 kB +0.63% 19.80 kB 19.92 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.42% 90.54 kB 90.93 kB +0.63% 19.80 kB 19.92 kB
oss-experimental/react-client/cjs/react-client-flight.development.js +0.42% 91.45 kB 91.83 kB +0.58% 20.21 kB 20.33 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js +0.42% 91.46 kB 91.85 kB +0.63% 19.92 kB 20.05 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js +0.42% 91.70 kB 92.09 kB +0.63% 19.99 kB 20.12 kB
oss-stable-semver/react/cjs/react.development.js +0.41% 93.37 kB 93.76 kB +0.46% 25.58 kB 25.70 kB
oss-stable/react/cjs/react.development.js +0.41% 93.40 kB 93.78 kB +0.48% 25.61 kB 25.73 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.41% 93.79 kB 94.18 kB +0.55% 20.77 kB 20.89 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.41% 93.79 kB 94.18 kB +0.55% 20.77 kB 20.89 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.41% 94.30 kB 94.69 kB +0.55% 20.94 kB 21.05 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.41% 94.30 kB 94.69 kB +0.55% 20.94 kB 21.05 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +0.40% 94.95 kB 95.34 kB +0.55% 20.97 kB 21.08 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +0.40% 95.46 kB 95.85 kB +0.53% 21.14 kB 21.25 kB
oss-experimental/react/cjs/react.development.js +0.40% 96.09 kB 96.47 kB +0.45% 26.16 kB 26.28 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.39% 98.22 kB 98.60 kB +0.58% 21.81 kB 21.94 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.39% 98.22 kB 98.60 kB +0.58% 21.81 kB 21.94 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.development.js +0.39% 99.38 kB 99.76 kB +0.58% 22.00 kB 22.13 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.38% 100.00 kB 100.38 kB +0.51% 22.37 kB 22.49 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.38% 100.00 kB 100.38 kB +0.51% 22.37 kB 22.49 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.38% 100.03 kB 100.42 kB +0.52% 22.40 kB 22.51 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.38% 100.03 kB 100.42 kB +0.52% 22.40 kB 22.51 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +0.38% 101.16 kB 101.54 kB +0.51% 22.56 kB 22.68 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +0.38% 101.19 kB 101.58 kB +0.51% 22.59 kB 22.70 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.38% 101.43 kB 101.82 kB +0.50% 22.76 kB 22.88 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.38% 101.43 kB 101.82 kB +0.50% 22.76 kB 22.88 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.38% 101.46 kB 101.84 kB +0.51% 22.80 kB 22.92 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.38% 101.46 kB 101.84 kB +0.51% 22.80 kB 22.92 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.37% 102.51 kB 102.89 kB +0.50% 22.97 kB 23.08 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.37% 102.51 kB 102.89 kB +0.50% 22.97 kB 23.08 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.37% 102.54 kB 102.92 kB +0.51% 23.01 kB 23.12 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.37% 102.54 kB 102.92 kB +0.51% 23.01 kB 23.12 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +0.37% 102.59 kB 102.98 kB +0.50% 22.95 kB 23.07 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +0.37% 102.62 kB 103.00 kB +0.51% 22.99 kB 23.11 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +0.37% 103.67 kB 104.05 kB +0.50% 23.16 kB 23.27 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +0.37% 103.70 kB 104.08 kB +0.51% 23.20 kB 23.31 kB
facebook-react-native/react/cjs/React-dev.js +0.37% 104.33 kB 104.71 kB +0.44% 27.97 kB 28.10 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +0.36% 106.91 kB 107.29 kB +0.43% 23.55 kB 23.65 kB
oss-stable/react-server/cjs/react-server-flight.development.js +0.36% 106.91 kB 107.29 kB +0.43% 23.55 kB 23.65 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +0.32% 118.96 kB 119.35 kB +0.39% 26.15 kB 26.26 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.24% 159.28 kB 159.66 kB +0.31% 34.98 kB 35.09 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.24% 159.28 kB 159.66 kB +0.31% 34.98 kB 35.09 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.23% 164.86 kB 165.24 kB +0.32% 36.17 kB 36.29 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.23% 164.86 kB 165.24 kB +0.32% 36.17 kB 36.29 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.23% 165.56 kB 165.95 kB +0.30% 36.41 kB 36.52 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.23% 165.56 kB 165.95 kB +0.30% 36.41 kB 36.52 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.23% 166.10 kB 166.49 kB +0.30% 36.45 kB 36.56 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.23% 166.10 kB 166.49 kB +0.30% 36.45 kB 36.56 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.23% 166.29 kB 166.67 kB +0.30% 36.52 kB 36.63 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.23% 166.29 kB 166.67 kB +0.30% 36.52 kB 36.63 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.23% 167.15 kB 167.54 kB +0.30% 36.41 kB 36.52 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.23% 167.15 kB 167.54 kB +0.30% 36.41 kB 36.52 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.23% 167.34 kB 167.72 kB +0.30% 36.46 kB 36.58 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.23% 167.34 kB 167.72 kB +0.30% 36.46 kB 36.58 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.development.js +0.23% 805.41 kB 807.24 kB +0.20% 175.59 kB 175.93 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.development.js +0.23% 805.43 kB 807.26 kB +0.20% 175.62 kB 175.96 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.development.js +0.23% 806.70 kB 808.52 kB +0.21% 175.88 kB 176.25 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.23% 169.79 kB 170.18 kB +0.30% 37.20 kB 37.32 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.23% 169.79 kB 170.18 kB +0.30% 37.20 kB 37.32 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.23% 169.97 kB 170.36 kB +0.30% 37.28 kB 37.39 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.23% 169.97 kB 170.36 kB +0.30% 37.28 kB 37.39 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.22% 171.99 kB 172.37 kB +0.29% 37.80 kB 37.91 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.22% 176.92 kB 177.30 kB +0.29% 38.77 kB 38.88 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.22% 177.62 kB 178.01 kB +0.28% 39.01 kB 39.12 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +0.21% 850.29 kB 852.12 kB +0.19% 183.91 kB 184.27 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.21% 178.84 kB 179.22 kB +0.29% 39.27 kB 39.39 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.21% 179.02 kB 179.41 kB +0.28% 39.35 kB 39.46 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.21% 179.86 kB 180.24 kB +0.29% 39.22 kB 39.33 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.21% 180.05 kB 180.43 kB +0.30% 39.28 kB 39.40 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.21% 182.50 kB 182.89 kB +0.29% 40.03 kB 40.15 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.21% 182.68 kB 183.07 kB +0.29% 40.11 kB 40.22 kB
test_utils/ReactAllWarnings.js Deleted 64.35 kB 0.00 kB Deleted 16.05 kB 0.00 kB

Generated by 🚫 dangerJS against 0f2b634

@sebmarkbage sebmarkbage force-pushed the currentownerinerror branch 3 times, most recently from 22fdb4b to 9e54e8f Compare May 10, 2024 20:02
[root]
<ErrorBoundary>
<ErrorBoundary>
Copy link
Collaborator Author

@sebmarkbage sebmarkbage May 10, 2024

Choose a reason for hiding this comment

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

What happens here is that now the console.error happens in the context of the source of the error, not in the error boundary, but that node gets deleted so it's no longer part of the tree.

That's what happens to the console.error already which is why it was only one marked here and not two (one for console.error and one for throw). (It was one before this PR and two before the stack but the other one is representing the console.error in TestRenderer, so it was the wrong one.)

It seems like maybe this UI should be adjusted but we have similar problems with infinitely suspended components whose fiber never commits.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like maybe this UI should be adjusted but we have similar problems with infinitely suspended components whose fiber never commits.

Ideally you'd still be able to narrow down the console.error. It was likely confusing to attach the error to the error boundary when that's not where it originated. But some indicator that the error originated from somewhere within this tree would be nice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it was attached to the error boundary but dropped before too. The thrown was attached to the error boundary.

The other previous error came from the TestRenderer warning about using test renderer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logs are tricky because there can be a done of completely unrelated logs in a subtree like the whole page that unmount. Not necessarily associated with the error that triggered the error boundary.

However, the actual error not being marked is clearly an issue.

Copy link

vercel bot commented May 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 4:32pm

This lets us expose the component stack to the error reporting that happens
here as console.error patching, but more importantly for "owner stacks"
this will be able to set the native async stacks to the original fiber.

We now use the normal console.error management to add a component stack to
the end.

# Conflicts:
#	packages/shared/consoleWithStackDev.js
@sebmarkbage sebmarkbage merged commit 2e540e2 into facebook:main May 23, 2024
40 checks passed
github-actions bot pushed a commit that referenced this pull request May 23, 2024
…ng (#29044)

This lets us expose the component stack to the error reporting that
happens here as `console.error` patching. Now if you just call
`console.error` in the error handlers it'll get the component stack
added to the end by React DevTools.

However, unfortunately this happens a little too late so the Fiber will
be disconnected with its `.return` pointer set to null already. So it'll
be too late to extract a parent component stack from but you can at
least get the stack from source to error boundary. To work around this I
manually add the parent component stack in our default handlers when
owner stacks are off. We could potentially fix this but you can also
just include it yourself if you're calling `console.error` and it's not
a problem for owner stacks.

This is not a problem for owner stacks because we'll still have those
and so for those just calling `console.error` just works. However, the
main feature is that by letting React add them, we can switch to using
native error stacks when available.

DiffTrain build for commit 2e540e2.
github-actions bot pushed a commit that referenced this pull request May 23, 2024
…ng (#29044)

This lets us expose the component stack to the error reporting that
happens here as `console.error` patching. Now if you just call
`console.error` in the error handlers it'll get the component stack
added to the end by React DevTools.

However, unfortunately this happens a little too late so the Fiber will
be disconnected with its `.return` pointer set to null already. So it'll
be too late to extract a parent component stack from but you can at
least get the stack from source to error boundary. To work around this I
manually add the parent component stack in our default handlers when
owner stacks are off. We could potentially fix this but you can also
just include it yourself if you're calling `console.error` and it's not
a problem for owner stacks.

This is not a problem for owner stacks because we'll still have those
and so for those just calling `console.error` just works. However, the
main feature is that by letting React add them, we can switch to using
native error stacks when available.

DiffTrain build for [2e540e2](2e540e2)
sebmarkbage added a commit that referenced this pull request May 25, 2024
)

Stacked on #29044.

To work with `console.createTask(...).run(...)` we need to be able to
run a function in the scope of the task.

The main concern with this, other than general performance, is that it
might add more stack frames on very deep stacks that hit the stack
limit. Such as with the commit phase where we recursively go down the
tree. These callbacks aren't really necessary in the recursive part but
only in the shallow invocation of the commit phase for each tag. So we
could refactor the commit phase so that only the shallow part at each
level is covered this way.
github-actions bot pushed a commit that referenced this pull request May 25, 2024
)

Stacked on #29044.

To work with `console.createTask(...).run(...)` we need to be able to
run a function in the scope of the task.

The main concern with this, other than general performance, is that it
might add more stack frames on very deep stacks that hit the stack
limit. Such as with the commit phase where we recursively go down the
tree. These callbacks aren't really necessary in the recursive part but
only in the shallow invocation of the commit phase for each tag. So we
could refactor the commit phase so that only the shallow part at each
level is covered this way.

DiffTrain build for commit b078c81.
hoxyq added a commit that referenced this pull request Jun 18, 2024
Full list of changes:

* chore[react-devtools]: improve console arguments formatting before
passing it to original console ([hoxyq](https://github.com/hoxyq) in
[#29873](#29873))
* chore[react-devtools]: unify console patching and default to ansi
escape symbols ([hoxyq](https://github.com/hoxyq) in
[#29869](#29869))
* chore[react-devtools/backend]: remove
consoleManagedByDevToolsDuringStrictMode
([hoxyq](https://github.com/hoxyq) in
[#29856](#29856))
* chore[react-devtools/extensions]: make source maps url relative
([hoxyq](https://github.com/hoxyq) in
[#29886](#29886))
* fix[react-devtools] divided inspecting elements between inspecting do…
([vzaidman](https://github.com/vzaidman) in
[#29885](#29885))
* [Fiber] Create virtual Fiber when an error occurs during reconcilation
([sebmarkbage](https://github.com/sebmarkbage) in
[#29804](#29804))
* fix[react-devtools] component badge in light mode is now not invisible
([vzaidman](https://github.com/vzaidman) in
[#29852](#29852))
* Remove Warning: prefix and toString on console Arguments
([sebmarkbage](https://github.com/sebmarkbage) in
[#29839](#29839))
* Add jest lint rules ([rickhanlonii](https://github.com/rickhanlonii)
in [#29760](#29760))
* [Fiber] Track the Real Fiber for Key Warnings
([sebmarkbage](https://github.com/sebmarkbage) in
[#29791](#29791))
* fix[react-devtools/store-test]: fork the test to represent current be…
([hoxyq](https://github.com/hoxyq) in
[#29777](#29777))
* Default native inspections config false
([vzaidman](https://github.com/vzaidman) in
[#29784](#29784))
* fix[react-devtools] remove native inspection button when it can't be
used ([vzaidman](https://github.com/vzaidman) in
[#29779](#29779))
* chore[react-devtools]: ip => internal-ip
([hoxyq](https://github.com/hoxyq) in
[#29772](#29772))
* Fix #29724: `ip` dependency update for CVE-2024-29415
([Rekl0w](https://github.com/Rekl0w) in
[#29725](#29725))
* cleanup[react-devtools]: remove unused supportsProfiling flag from
store config ([hoxyq](https://github.com/hoxyq) in
[#29193](#29193))
* [Fiber] Enable Native console.createTask Stacks When Available
([sebmarkbage](https://github.com/sebmarkbage) in
[#29223](#29223))
* Move createElement/JSX Warnings into the Renderer
([sebmarkbage](https://github.com/sebmarkbage) in
[#29088](#29088))
* Set the current fiber to the source of the error during error
reporting ([sebmarkbage](https://github.com/sebmarkbage) in
[#29044](#29044))
* Unify ReactFiberCurrentOwner and ReactCurrentFiber
([sebmarkbage](https://github.com/sebmarkbage) in
[#29038](#29038))
* Dim `console` calls on additional Effect invocations due to
`StrictMode` ([eps1lon](https://github.com/eps1lon) in
[#29007](#29007))
* refactor[react-devtools]: rewrite context menus
([hoxyq](https://github.com/hoxyq) in
[#29049](#29049))
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.

6 participants