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 more information to isValidDescriptor invariant error #1969

Closed
wants to merge 1 commit into from

Conversation

brigand
Copy link
Contributor

@brigand brigand commented Aug 1, 2014

Just a minor tweak to tell you what's being returned (I had a problem where an array was being returned earlier today).

This ternary is completely to work around a bug in PhantomJS's implementation of Object::toString which gives DOMWindow for some reason when called on undefined or null and caused the tests to fail. V8, SM, and JSC all work correctly for all values (per spec).

        renderedComponent === undefined 
          ? 'Undefined' 
          : Object.prototype.toString.call(renderedComponent).slice(8, -1),

@sebmarkbage
Copy link
Collaborator

I'm wondering if this needs to be extrapolated...? If it's needed here, isn't it also needed in every possible error message? Currently, the solution is to insert breakpoints so that you can inspect the exact value. It may be any other object which is also not valid.

Seems like this is trying to address arrays in particular, which is a confusing aspect of React. I think an isArray check with an error message linking or explaining why Arrays are not supported and potential workarounds would be better.

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