-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Throw more specific error if passed undefined in React.cloneElement #12534
Merged
gaearon
merged 14 commits into
facebook:master
from
wherestheguac:clone-element-throw-error-on-undefined
Apr 10, 2018
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7bc5fd5
throw error if passed undefined
8ee2452
should be TypeError
33d1edf
simplify
48c7b53
use invariant
34816fc
editor messed up spacing
2733707
better check
44df599
Revert "better check"
7f6d18b
Merge branch 'master' into clone-element-throw-error-on-undefined
baa4d84
yarn prettier test was failing
80de944
more explicit copy
e3416ee
es6 import
905abfc
tests
d20de72
formatting
070ef20
Move import
gaearon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 could just use a loose equality check here
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.
Ah right yes, because the type conversion will catch undefined 👍
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.
FWIW, we've intentionally stopped using loose checks a while ago because they sometimes cause engine deoptimizations. I'd prefer strict ones.
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.
@gaearon didn't know that. We still have tons of places where we use loose equality checks.
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.
@gaearon okay gotcha, reverted that.
@aweary I can look into switching some over in a PR maybe? That should be pretty straightforward and I would love the opportunity to get more familiar with the codebase.
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.
@nicolevy I don't know, I'm not sure it's worth it? It could be helpful to make the changes and then somehow benchmark them. I'd also be interested in seeing a profile that shows the current deoptimizations and their impact as well. Making all the checks strict would increase the overall bundle size, so there are other costs to consider.
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.
@aweary hmmm okay, I’ll wait until a decision is made before I start on that then.