-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Elements from functional components in TestUtils should have no owner #6362
Conversation
@@ -61,6 +61,10 @@ function warnIfInvalidElement(Component, element) { | |||
} | |||
} | |||
|
|||
function isNewable(Component) { |
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.
Maybe this should be called "shouldConstruct" or something like that? Functional components can be "newable" in the ECMAScript sense but shouldn't be called with new.
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.
shouldConstruct
sounds good. A little misleading that we still call _constructComponent
even though shouldConstruct
can be false
but I’m out of good function names at this point. (instantiate*
is taken for another purpose 😄 )
EDIT: nvm. I misread. cc @spicyj You have a lot more context on this. |
Sure, I’m fine holding it off till 15.0.1 or something along with #6353. |
@gaearon updated the pull request. |
I looked but don't know what is best here without spending a lot more time thinking. |
What are the bad implications of this? Sure it’s a hack, but it’s pretty much identical to how we fix the same case for |
I didn't realize we did that for render already. Sure, this seems okay. |
Yeah. Owner is a goner anyway so I think we should be able to remove these hacks before 16. |
Well, owner is sticking around as long as we support string refs unless I missed something. |
Can we deprecate them during 15.x? |
We haven't thought it's worth it because the new API is significantly less convenient. |
We can always consider it, though. |
I generally don't think we should deprecate things unless we're willing or have already done the work internally at FB. (I don't think we are yet. The trade off isn't worth the work.) We use ourselves as a proxy. I don't want to tell others to do work that we're not willing to do ourselves. |
I’m getting this in since it fixes a bug and the workaround is on par with a similar workaround we’re already using. We have a test too so we won’t regress until this is fixed in a better way. |
Elements from functional components in TestUtils should have no owner (cherry picked from commit ae56910)
Another take at fixing #5292 and #6194. We’ll fix it more permanently later once we completely remove the owner but it is still currently useful for warnings and ReactPerf.
Reviewers: @sebmarkbage