-
Notifications
You must be signed in to change notification settings - Fork 47k
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 invariant for a mixin not to be undefined. #1305
Conversation
@@ -332,6 +332,10 @@ var RESERVED_SPEC_KEYS = { | |||
mixins: function(ConvenienceConstructor, mixins) { | |||
if (mixins) { | |||
for (var i = 0; i < mixins.length; i++) { | |||
invariant( | |||
mixins[i] !== 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.
We should move this check into mixSpecIntoComponent
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.
Moved.
Should have said this before too, but can you rebase? Things have changed a bit so this doesn't apply |
Rebased. |
@@ -438,6 +438,11 @@ function validateLifeCycleOnReplaceState(instance) { | |||
*/ | |||
function mixSpecIntoComponent(ConvenienceConstructor, spec) { | |||
invariant( | |||
spec !== 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.
Minor nit: you have a double space here.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Still trying to figure out what to do with this one. Jest mocks functions so |
We need to clean that up in our tests. This is a problem with jest and silently failing seems like a terrible testing strategy. |
@sebmarkbage Anything we can do here? #2687 is another request for this. |
Meh. Let's just pull it in. FB's existing tests failing isn't a reason to block this. We'll have to fix our shit. |
@andreypopp Mind rebasing? This has since moved to src/class/ReactClass.js. |
Closing due to lack of activity, and mixins are now a legacy feature that we'd like to avoid changing unnecessarily. |
Fixes #1302.