-
Notifications
You must be signed in to change notification settings - Fork 48k
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
Clearer ssr error message 11902 #11966
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -889,12 +889,33 @@ class ReactDOMServerRenderer { | |
break; | ||
} | ||
} | ||
|
||
let info = ''; | ||
if (__DEV__) { | ||
const owner = elementType && elementType._owner; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm wait. I don't see how this could work. Owner is defined on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In other words you want |
||
if ( | ||
elementType === undefined || | ||
(typeof elementType === 'object' && | ||
elementType !== null && | ||
Object.keys(elementType).length === 0) | ||
) { | ||
info += | ||
' You likely forgot to export your component from the file ' + | ||
"it's defined in, or you might have mixed up default and " + | ||
'named imports.'; | ||
} | ||
const ownerName = owner ? getComponentName(owner) : null; | ||
if (ownerName) { | ||
info += '\n\nCheck the render method of `' + ownerName + '`.'; | ||
} | ||
} | ||
invariant( | ||
false, | ||
'Element type is invalid: expected a string (for built-in ' + | ||
'components) or a class/function (for composite components) ' + | ||
'but got: %s.', | ||
'but got: %s.%s', | ||
elementType == null ? elementType : typeof elementType, | ||
info, | ||
); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add another test case for undefined type.