Skip to content

Provide a friendly path for reactID errors in ReactMount #1987

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

Closed
wants to merge 1 commit into from
Closed

Provide a friendly path for reactID errors in ReactMount #1987

wants to merge 1 commit into from

Conversation

syranide
Copy link
Contributor

@syranide syranide commented Aug 3, 2014

Dissected from my #1570

Provides a human friendly path instead of just a rather opaque reactID. Chrome still has intermittent issues with long error messages being truncated, but this is supposedly fixed (again) in Chrome 37. No other browsers should have issues displaying the full error message.

Now that we have friendlier error messages, how far do we want go to "resolve" implicitly added DOM? Personally I feel like we should get rid of the "blind jumps" we do now (primarily missing thead), it seems like unsafe behavior and it would be preferable for users to just be notified of the issue instead (technically, they provided invalid markup).

Invariant Violation: findComponentRoot(..., .0.1.0:0:0.0.0.0.0): Unable to find element.
This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to
forgetting a <tbody> when using tables, nesting tags like <form>, <p>, or <a>, or using
non-SVG elements in an <svg> parent. Inspect: Root > DIV.0 > SPAN.1 > Children1 > Children2
> Children3 > FORM.0:0:0 > TABLE.0 > TR.0 > TD.0 > FORM.0

(That error message is for nested form, which is invalid)

 +3123   +798 build/react-with-addons.js
    +7     -1 build/react-with-addons.min.js
 +3123   +809 build/react.js
    +7      = build/react.min.js

@sophiebits
Copy link
Collaborator

I added validateDOMNesting so I don't think this is as useful any more.

@sophiebits sophiebits closed this Aug 20, 2015
@syranide
Copy link
Contributor Author

This applies to many other errors as well though (although perhaps not currently covered by this old PR), where you're currently only shown a data-reactid? But yes, not as important anymore ... although it may be useful for more problematic production errors where data-reactid is very rarely useful knowledge.

@sophiebits
Copy link
Collaborator

AFAIK all the current errors that mention data-reactid are completely unactionable for someone unfamiliar with React's internals.

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.

4 participants