Skip to content

Inject getCurrentFiber() function to DevTools #16133

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

Merged
merged 1 commit into from
Jul 15, 2019

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jul 15, 2019

This returns the current value of ReactCurrentFiber and enables DevTools to append a custom (owner-only) component stack to warnings and errors in DEV mode.

This is an attempt to address concerns about component stacks being overly noisy in certain environments. It does feel like an improvement based on even my own test harness, e.g.
image

Supersedes #16127

This returns the current value of ReactCurrentFiber and enables DevTools to append a custom (owner-only) component stack to warnings and errors in DEV mode.
@sizebot
Copy link

sizebot commented Jul 15, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS

@bvaughn bvaughn merged commit 424099d into facebook:master Jul 15, 2019
@bvaughn bvaughn deleted the DevTools-inject-getCurrentFiber branch July 15, 2019 14:38
@sebmarkbage
Copy link
Collaborator

Current fiber should never be used because it's meant to support production runtime semantics (like string refs) which are not the same as the ones powering the debug frame. If you need something different than debug frame for some mechanism, then you should add something to debug frame separately from this field. That way current fiber's details can change and be removed from runtime separately from debug information. E.g. current fiber should really be null in class constructors but I think it's not because someone at some point wanted the debug info in the class constructor and subsequently negatively affected our string ref semantics.

That said, I don't get why debug frame isn't enough since the filtering of owners has to be done using the owner field on the fibers anyway.

@bvaughn
Copy link
Contributor Author

bvaughn commented Jul 17, 2019

We chatted and I think you were confusing ReactCurrentOwner with ReactCurrentFiber. I think ReactCurrentFiber (the one we're using) is the right one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants