-
Notifications
You must be signed in to change notification settings - Fork 49.2k
[Flight] Log error if prod elements are rendered #34189
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
Conversation
'Attempted to render <span key="one"> without development properties. This is not supported. It can happen if:' + | ||
'\n- The element is created with a production version of React but rendered in development.' + | ||
'\n- The element was cloned with a custom function instead of `React.cloneElement`.\n' + | ||
"The props of this element may help locate this element: { children: 'Free!', [key]: [Getter] }", |
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.
Not the prettiest to include the legacy key getter but it gets the job done.
key = ' key="' + element.key + '"'; | ||
} | ||
|
||
console.error( |
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.
We usually don't do conditional throws but maybe this here is a valid exception since we'll throw later anyway in dev when accessing .stack
?
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.
We might fix that to not throw though and then it would become unbalanced.
We previously encountered these errors with MDX. The newest issue was a
lodash.cloneDeep(objWithReactElements)
.Example: