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

Add a fallback component name for warnings #12429

Merged
merged 1 commit into from
Mar 22, 2018

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Mar 22, 2018

There used to be no fallback, leading to warnings like this for anonymous components:

screen shot 2018-03-22 at 5 05 04 pm

screen shot 2018-03-22 at 5 03 42 pm

This fixes them:

screen shot 2018-03-22 at 5 04 42 pm

screen shot 2018-03-22 at 5 04 15 pm

I tried writing a unit test but it's pretty annoying to reproduce without createClass, and that has its own warnings so it gets a bit confusing. Issues like #12428 and #12427 also made writing tests a bit painful. I'm happy to revisit with a test when those are resolved.

getComponentName(workInProgress),
);
const state = instance.state;
if (state && (typeof state !== 'object' || isArray(state))) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is indentation change to make DEV-only intent clear (even though the whole function is only called in DEV).
But I also made it use name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gaearon gaearon requested a review from bvaughn March 22, 2018 17:18
@gaearon gaearon merged commit dcbb430 into facebook:master Mar 22, 2018
LeonYuAng3NT pushed a commit to LeonYuAng3NT/react that referenced this pull request Mar 22, 2018
rhagigi pushed a commit to rhagigi/react that referenced this pull request Apr 19, 2018
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.

3 participants