Skip to content

feat(UJS) show helpful error messages for missing components #538

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

Merged

Conversation

danielma
Copy link
Contributor

The Problem

Currently, if you use an invalid component name in data-react-class,
you get a React invariant error that only tells you that the component
class was undefined, but it doesn't actually help you fix the error. I
end up needing to scroll backwards in the stack trace until I find this
part of the react_ujs_mount.js code and inspect the value of
className

screen shot 2016-05-25 at 11 36 04 am

The Solution

Throw a helpful error (and nice console log message) about an invalid
className at the moment we try to mount the component. You can even right-click
and Reveal in Elements Panel to see exactly where the element is in the DOM!

screen shot 2016-05-25 at 11 37 23 am

The Problem
-----------

Currently, if you use an invalid component name in `data-react-class`,
you get a React invariant error that only tells you that the component
class was undefined, but it doesn't actually help you fix the error. I
end up needing to scroll backwards in the stack trace until I find this
part of the `react_ujs_mount.js` code and inspect the value of
`className`

The Solution
------------

Throw a helpful error (and nice console log message) about an invalid
className at the moment we try to mount the component.
@rmosolgo
Copy link
Member

🎉 thanks, that's awesome! this will prevent a lot of github issues, too!

@rmosolgo rmosolgo merged commit 7fa90ea into reactjs:master May 25, 2016
@danielma danielma deleted the dma/component-missing-helpful-error branch May 25, 2016 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants