react icon indicating copy to clipboard operation
react copied to clipboard

[Fiber] Use Owner/JSX Stack When Appending Stacks to Console

Open sebmarkbage opened this issue 1 year ago • 2 comments

This one should be fully behind the enableOwnerStacks flag.

Instead of printing the parent Component stack all the way to the root, this now prints the owner stack of every JSX callsite. It also includes intermediate callsites between the Component and the JSX call so it has potentially more frames. Mainly it provides the line number of the JSX callsite. In terms of the number of components is a subset of the parent component stack so it's less information in that regard. This is usually better since it's more focused on components that might affect the output but if it's contextual based on rendering it's still good to have parent stack. Therefore, I still use the parent stack when printing DOM nesting warnings but I plan on switching that format to a diff view format instead (Next.js already reformats the parent stack like this).

Follow ups

  • Server Components show up in the owner stack for client logs but logs done by Server Components don't yet get their owner stack printed as they're replayed. They're also not yet printed in the server logs of the RSC server.

  • Server Component stack frames are formatted as the server and added to the end but this might be a different format than the browser. E.g. if server is running V8 and browser is running JSC or vice versa. Ideally we can reformat them in terms of the client formatting.

  • This doesn't yet update Fizz or DevTools. Those will be follow ups. Fizz still prints parent stacks in the server side logs. The stacks added to user space console.error calls by DevTools still get the parent stacks instead.

  • It also doesn't yet expose these to user space so there's no way to get them inside onCaughtError for example or inside a custom console.error override.

  • In another follow up I'll use console.createTask instead and completely remove these stacks if it's available.

sebmarkbage avatar May 21 '24 21:05 sebmarkbage

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:57pm

vercel[bot] avatar May 21 '24 21:05 vercel[bot]

Comparing: 84239da896fd7395a667ab1e7ef1ef338a32de8f...65d16bbe42fa6dc82a754b13bc690bbe3c70e88b

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 = 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.02% 495.90 kB 495.99 kB = 88.79 kB 88.79 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.02% 500.70 kB 500.79 kB = 89.47 kB 89.48 kB
facebook-www/ReactDOM-prod.classic.js +0.02% 593.46 kB 593.55 kB = 104.41 kB 104.41 kB
facebook-www/ReactDOM-prod.modern.js +0.02% 569.84 kB 569.93 kB = 100.80 kB 100.80 kB
test_utils/ReactAllWarnings.js Deleted 64.27 kB 0.00 kB Deleted 16.06 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/cjs/react-jsx-runtime.react-server.development.js +1.23% 27.54 kB 27.88 kB +0.31% 8.93 kB 8.96 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.react-server.development.js +1.23% 27.55 kB 27.88 kB +0.31% 8.93 kB 8.96 kB
oss-experimental/react-art/cjs/react-art.development.js +1.00% 829.47 kB 837.78 kB +1.12% 179.77 kB 181.80 kB
react-native/implementations/ReactFabric-dev.js +0.96% 864.90 kB 873.21 kB +1.10% 187.62 kB 189.68 kB
react-native/implementations/ReactNativeRenderer-dev.js +0.95% 878.09 kB 886.40 kB +1.09% 191.57 kB 193.66 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.89% 931.48 kB 939.80 kB +1.00% 200.23 kB 202.24 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js +0.79% 25.93 kB 26.13 kB +0.25% 8.45 kB 8.47 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.78% 1,302.09 kB 1,312.26 kB +0.81% 289.28 kB 291.62 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.77% 1,320.21 kB 1,330.38 kB +0.78% 293.72 kB 296.00 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.77% 1,320.77 kB 1,330.94 kB +0.78% 292.68 kB 294.97 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.development.js +0.44% 41.31 kB 41.49 kB +0.15% 12.53 kB 12.55 kB
oss-stable/react/cjs/react-jsx-dev-runtime.development.js +0.44% 41.31 kB 41.49 kB +0.15% 12.53 kB 12.55 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.development.js +0.43% 42.96 kB 43.14 kB +0.21% 13.00 kB 13.02 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.development.js +0.43% 42.96 kB 43.14 kB +0.21% 13.00 kB 13.02 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.react-server.development.js +0.43% 42.96 kB 43.15 kB +0.21% 13.00 kB 13.03 kB
oss-stable/react/cjs/react-jsx-dev-runtime.react-server.development.js +0.43% 42.96 kB 43.15 kB +0.21% 13.00 kB 13.03 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js +0.43% 42.11 kB 42.29 kB +0.19% 12.77 kB 12.79 kB
facebook-www/JSXDEVRuntime-dev.classic.js +0.35% 51.59 kB 51.77 kB +0.14% 14.56 kB 14.58 kB
facebook-www/JSXDEVRuntime-dev.modern.js +0.35% 51.62 kB 51.80 kB +0.14% 14.56 kB 14.58 kB
facebook-react-native/react/cjs/React-dev.js +0.28% 104.38 kB 104.67 kB +0.15% 28.05 kB 28.09 kB
facebook-www/React-dev.modern.js +0.25% 115.74 kB 116.03 kB +0.19% 30.06 kB 30.11 kB
facebook-www/React-dev.classic.js +0.25% 116.23 kB 116.52 kB +0.18% 30.16 kB 30.21 kB
test_utils/ReactAllWarnings.js Deleted 64.27 kB 0.00 kB Deleted 16.06 kB 0.00 kB

Generated by :no_entry_sign: dangerJS against 65d16bbe42fa6dc82a754b13bc690bbe3c70e88b

react-sizebot avatar May 21 '24 21:05 react-sizebot