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

Delimit dynamic part of the warning messages with newlines #8719

Closed
gaearon opened this issue Jan 9, 2017 · 15 comments
Closed

Delimit dynamic part of the warning messages with newlines #8719

gaearon opened this issue Jan 9, 2017 · 15 comments
Assignees

Comments

@gaearon
Copy link
Collaborator

gaearon commented Jan 9, 2017

As proposed in #8495 (comment), I think we should find the warnings where we add a dynamic part to the end (like "Check the render method of <...>") and delimit it with two newlines. This way it’s much easier to recognize in the middle of a bunch of errors:

This is a good first issue to contribute. You would need to find warning() calls that include additional info like Check the render method of and add a couple of newlines. You'd also need to change the tests in case they fail.

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 9, 2017

Assigning myself so I don’t forget about this issue.
But this is a good place to get your feet wet with the React codebase.

I don’t intend to work on this myself but will be happy to review your PR.

@gaearon gaearon self-assigned this Jan 9, 2017
@richiethomas
Copy link
Contributor

I'd like to work on this issue. :)

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 9, 2017

👍 Please send a PR and ping me!

@richiethomas
Copy link
Contributor

richiethomas commented Jan 9, 2017

@gaearon - while browsing through 'codebase-overview.md', I noticed a potential typo in the markdown. On line 116, there appears to be one too many "`" marks, resulting in the rest of the file appearing as code, instead of regular text with code excerpts interspersed when relevant:

screen shot 2017-01-09 at 2 38 51 pm

I'm happy to fix this as well, but should I create a separate issue for this and submit a PR, or just bundle the fix together with my work on issue #8719?

Here's what the markdown would look like with one less "`" symbol:

screen shot 2017-01-09 at 2 42 08 pm

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 9, 2017

Please create a separate PR.

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 9, 2017

While unrelated, I generally recommend reading docs on the website:
https://facebook.github.io/react/contributing/codebase-overview.html

@AshikNesin
Copy link

@richiethomas You are working on this issue ?

@richiethomas
Copy link
Contributor

richiethomas commented Jan 11, 2017

@AshikNesin yes, I am. :)

@gaearon I'd like to make sure I have it right before submitting a PR. As an example of the change being requested, one of the files I'd change would be ReactElementValidator.js, line 36. Looks like I would add 2 newlines at the start of the string that's returned from the 'getDeclarationErrorAddendum' function. In other words, change:

' Check the render method of ' + name + '.';

to this:

'\n\n Check the render method of ' + name + '.';

If I have it right, I'll submit a PR for this fix later today.

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 11, 2017

Something like this. But there's a few more similar places you'd need to change.

@richiethomas
Copy link
Contributor

Yep, that's what I understood. Will submit a PR soon. Cheers.

richiethomas pushed a commit to richiethomas/react that referenced this issue Jan 11, 2017
* 'getDeclarationErrorAddendum' function of ReactDOMComponent.js
* 'getSourceInfoErrorAddendum' function of ReactElementValidator.js
* 'getDeclarationErrorAddendum' function of instantiateReactComponent.js and ReactElementValidator.js
* 'traverseAllChildrenImpl' function of traverseAllChildren.js
* 'attachRef' function of ReactRef.js
* 'mountIndeterminateComponent' function of ReactFiberBeginWork.js
* 'createFiberFromElementType' function of ReactFiber.js
* 'getDeclarationErrorAddendum' function of ReactDOMSelect.js
* 'unmountComponentAtNode' function of ReactMount.js
* 'getDeclarationErrorAddendum' function of ReactControlledValuePropTypes.js
* 'checkRenderMessage' function of CSSPropertyOperations.js
* 'getDeclarationErrorAddendum' function of ReactDomFiberSelect.js
* 'getCurrentComponentErrorInfo' function in 'ReactElementValidator'
* 'getDeclarationErrorAddendum' function in ReactDOMFiberComponent.js

Fixes facebook#8719
@richiethomas
Copy link
Contributor

richiethomas commented Jan 11, 2017

I caught all dynamically-generated warnings which contain the phrase "Check", but I also found similar warnings with different verbage so I'm doing a more fine-grained search now. If it's OK, I'll submit a follow-up PR if I find anything.

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 11, 2017

Best to put them all in one PR I think.

@richiethomas
Copy link
Contributor

OK. So that I understand, the spirit of this bugfix is to only address the dynamically-generated warnings with large blocks of text, right? If a warning has dynamic content but is small, easily parseable, and clearly shows which file is problematic, there's no need for a newline, right?

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 11, 2017

Yes. I want to fix those that are easy to miss and add info at the very end of a long message.

@richiethomas
Copy link
Contributor

richiethomas commented Jan 18, 2017

@gaearon as requested, here's a ping to say that this PR is ready for review. Cheers! :)

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

No branches or pull requests

3 participants