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

[flags] remove enableOwnerStacks #32426

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rickhanlonii
Copy link
Member

@rickhanlonii rickhanlonii commented Feb 19, 2025

Bassed off: #32425

Wait to land internally.

Commit to review.

This has landed everywhere

@react-sizebot
Copy link

react-sizebot commented Feb 23, 2025

Comparing: 2567726...c729aa1

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.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 515.71 kB 515.71 kB = 92.09 kB 92.09 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 565.64 kB 565.64 kB = 100.84 kB 100.84 kB
facebook-www/ReactDOM-prod.classic.js = 636.70 kB 636.70 kB = 112.08 kB 112.08 kB
facebook-www/ReactDOM-prod.modern.js = 627.02 kB 627.02 kB = 110.50 kB 110.50 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react/cjs/react.react-server.development.js = 28.92 kB 28.86 kB = 6.96 kB 6.94 kB
oss-stable-semver/react/cjs/react.react-server.development.js = 28.90 kB 28.84 kB = 6.93 kB 6.91 kB
oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js = 133.90 kB 133.60 kB = 31.23 kB 31.18 kB
oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js = 133.88 kB 133.57 kB = 31.21 kB 31.15 kB
oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.development.js = 145.49 kB 145.15 kB = 34.12 kB 34.06 kB
test_utils/ReactAllWarnings.js = 63.51 kB 63.22 kB = 15.89 kB 15.82 kB
facebook-www/JSXDEVRuntime-dev.classic.js = 12.70 kB 12.64 kB = 3.44 kB 3.42 kB
facebook-www/JSXDEVRuntime-dev.modern.js = 12.70 kB 12.64 kB = 3.44 kB 3.42 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.react-server.development.js = 12.15 kB 12.09 kB = 3.32 kB 3.30 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.development.js = 12.15 kB 12.09 kB = 3.32 kB 3.30 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.react-server.development.js = 12.01 kB 11.95 kB = 3.28 kB 3.26 kB
oss-stable/react/cjs/react-jsx-dev-runtime.react-server.development.js = 12.01 kB 11.95 kB = 3.28 kB 3.26 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.development.js = 12.00 kB 11.94 kB = 3.28 kB 3.25 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.development.js = 12.00 kB 11.94 kB = 3.28 kB 3.25 kB
oss-experimental/react/cjs/react-jsx-runtime.development.js = 11.53 kB 11.47 kB = 3.19 kB 3.17 kB
oss-stable-semver/react/cjs/react-jsx-runtime.development.js = 11.38 kB 11.32 kB = 3.15 kB 3.13 kB
oss-stable/react/cjs/react-jsx-runtime.development.js = 11.38 kB 11.32 kB = 3.15 kB 3.13 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js = 11.33 kB 11.27 kB = 3.17 kB 3.15 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js = 11.32 kB 11.26 kB = 3.11 kB 3.09 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.development.js = 11.18 kB 11.12 kB = 3.13 kB 3.11 kB
oss-stable/react/cjs/react-jsx-dev-runtime.development.js = 11.18 kB 11.12 kB = 3.13 kB 3.11 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js = 11.12 kB 11.06 kB = 3.09 kB 3.07 kB

Generated by 🚫 dangerJS against 886812d

@@ -135,6 +135,7 @@ export function supportsConsoleTasks(fiber: Fiber): boolean {
return !!fiber._debugTask;
}

// TODO: clean this up?
Copy link
Member Author

Choose a reason for hiding this comment

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

@sebmarkbage is it safe for me to delete this? Not sure about devtools versioning

Copy link
Collaborator

Choose a reason for hiding this comment

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

No it's not safe to delete because this is the feature detection whether this version of React supports owner stacks or not.

@@ -1102,6 +1102,7 @@ export function attach(

function getComponentStack(
topFrame: Error,
// TODO: is this needed now that owner stacks have landed? e.g. for backwards compat of devtools?
Copy link
Member Author

Choose a reason for hiding this comment

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

@sebmarkbage same here - can I remove the enableOwnerStacks value returned?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, because it feature detects the version.

Copy link
Contributor

@hoxyq hoxyq Feb 24, 2025

Choose a reason for hiding this comment

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

Yeah, all changes in React DevTools files should maintain compatibility with older versions of React and its internals.

@@ -917,7 +917,7 @@ export function createProfilingHooks({
// Creating a cache of component stacks won't help, generating a single stack is already expensive enough.
// We should find a way to lazily generate component stacks on demand, when user inspects a specific event.
// If we succeed with moving React DevTools Timeline Profiler to Performance panel, then Timeline Profiler would probably be removed.
// If not, then once enableOwnerStacks is adopted, revisit this again and cache component stacks per Fiber,
// Now that owner stacks are adopted, revisit this again and cache component stacks per Fiber,
Copy link
Member Author

Choose a reason for hiding this comment

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

@sebmarkbage relevant comment, not sure if this is still planned

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about this one. This is @hoxyq's work.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not planned, just an idea for the future, when I was triaging why RDT profiling is slow - #31154.

One of the reasons why it was that slow is because we were recording component (parent) stack eagerly for each state update. With owner stacks we could re-use the information thats already on Fiber / Virtual instance.

if (__DEV__) {
const getCurrentStack = ReactSharedInternals.getCurrentStack;
if (getCurrentStack === null) {
// TODO: when is this true?
Copy link
Member Author

Choose a reason for hiding this comment

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

@sebmarkbage is this null check needed now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it's when you're outside an active renderer. The idea is that when you're outside a React render you get null. When you're inside a React render but we don't have a stack you get ''. That way you can decide to display it differently.

@@ -356,6 +356,7 @@ export type OnErrorOrWarning = (
) => void;
export type GetComponentStack = (
topFrame: Error,
// TODO: is this needed now that owner stacks have landed? e.g. for backwards compat of devtools?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Still needed.

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.

5 participants