-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Rename the react.element symbol to react.transitional.element #28813
Changes from all 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 |
---|---|---|
|
@@ -32,6 +32,7 @@ import { | |
REACT_PORTAL_TYPE, | ||
REACT_LAZY_TYPE, | ||
REACT_CONTEXT_TYPE, | ||
REACT_LEGACY_ELEMENT_TYPE, | ||
} from 'shared/ReactSymbols'; | ||
import { | ||
HostRoot, | ||
|
@@ -166,6 +167,16 @@ function coerceRef( | |
} | ||
|
||
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) { | ||
if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE) { | ||
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. I think this might be missing the flag check (haven't run the code internally yet). Not sure why tests wouldn't fail. 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. We only get to this error handling path when there's no match, but with the flag off there would be a match. This is just detecting which error message to provide if there's an error. |
||
throw new Error( | ||
'A React Element from an older version of React was rendered. ' + | ||
'This is not supported. It can happen if:\n' + | ||
'- Multiple copies of the "react" package is used.\n' + | ||
'- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n' + | ||
'- A compiler tries to "inline" JSX instead of using the runtime.', | ||
); | ||
} | ||
|
||
// $FlowFixMe[method-unbinding] | ||
const childString = Object.prototype.toString.call(newChild); | ||
|
||
|
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.
From what I can tell, these are not used anyway but if we did, we'd check for both.