Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

fix(getData): fix Stateless Functional Component source code doesn't … #557

Closed
wants to merge 2 commits into from

Conversation

nuoyz
Copy link

@nuoyz nuoyz commented Feb 19, 2017

fix Stateless Functional Component source code doesn't show up correctly

@nuoyz
Copy link
Author

nuoyz commented Feb 19, 2017

react-devtool-stateless

@gaearon
Copy link
Contributor

gaearon commented Feb 24, 2017

I don't think this is the right fix. You are mutating the instance which we should avoid.
Can we change the "Show Source" function to always use type instead of constructor?

Copy link
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

See comment above

@@ -42,7 +42,7 @@ var config: Props = {
// the constructor. Otherwise, inspect the render function.
var code = `Object.getOwnPropertyDescriptor(window.${vbl}.__proto__.__proto__, 'isMounted') &&
Object.getOwnPropertyDescriptor(window.${vbl}.__proto__.__proto__, 'isMounted').value ?
inspect(window.${vbl}.render) : inspect(window.${vbl}.constructor)`;
inspect(window.${vbl}.render) : inspect(window.${vbl}._reactInternalInstance._currentElement.type)`;
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 a bit gross because we're looking at internals but I don't really have a better alternative. Let's just fix this to work in Fiber: inspect(typeof window.${vbl}._reactInternalInstance.tag === 'number' ? window.${vbl}._reactInternalInstance.type : window.${vbl}._reactInternalInstance._currentElement.type)

@gaearon
Copy link
Contributor

gaearon commented Apr 20, 2017

Closing as review comments have not been addressed. Thanks for the PR though!

@gaearon gaearon closed this Apr 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants