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

DevTools: Show Source should point to render, not constructor #16749

Closed
theKashey opened this issue Sep 11, 2019 · 2 comments · Fixed by #16759
Closed

DevTools: Show Source should point to render, not constructor #16749

theKashey opened this issue Sep 11, 2019 · 2 comments · Fixed by #16759

Comments

@theKashey
Copy link
Contributor

Do you want to request a feature or report a bug?

Bug. Regression to be more concrete - facebook/react-devtools#1191

What is the current behavior?

Show Source points to a Function Component body, and Class Component constructor.

What is the expected behavior?

In both cases, you should see "render" methods, class constructor is never something you might want to jump straight into. It was working in this expected way in a previous version of Dev Tools.

Why this is an issue?

Well, until React-Hot-Loader is not 100% deprecated, "Show Source" would not work at all, as long as it (and not only it - mobx would do the same) is wrapping class constructor, however keeping render untouched.

@theKashey
Copy link
Contributor Author

theKashey commented Sep 11, 2019

Basically this should be backported:

https://github.com/facebook/react-devtools/blob/v3.3.2/shells/webextension/src/panel.js#L73-L83

to here

chrome.devtools.inspectedWindow.eval(`
if (window.$type != null) {
inspect(window.$type);
}

I hope this simplification was not intentional.

@theKashey theKashey changed the title DevTools: Show Source should point to render, not contructor DevTools: Show Source should point to render, not constructor Sep 11, 2019
@bvaughn
Copy link
Contributor

bvaughn commented Sep 11, 2019

PRs are welcome.

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

Successfully merging a pull request may close this issue.

2 participants