Skip to content

Warn if context values differ, related to issue #2 #2602

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

Merged
merged 1 commit into from
Nov 26, 2014

Conversation

jimfb
Copy link
Contributor

@jimfb jimfb commented Nov 25, 2014

Warn if context values differ, related to issue #2112

@@ -595,18 +595,39 @@ var ReactCompositeComponentMixin = assign({},
* TODO: Remove this check when owner-context is removed
*/
_warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
if (!__DEV__) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the code gets properly stripped out for the minified build if you don't do if (__DEV__) { ... }.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It does in open-source, not sure for www though.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it works internally (basically __DEV__ gets replaced with 0 from what I can find)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant the minifier specifically – I'm sure the runtime behavior is correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was talking about actually, we replace before minifying.

But that said, we don't actually need this check and we should just wrap callsites with if (__DEV__). The only callsite is already wrapped so it's unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, great, removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I'm still talking past you – my understanding is that your minifier is smart enough to turn if (0) { foo(); } into nothing but isn't smart enough to turn if (1) { return; } foo(); into nothing.

@jimfb jimfb force-pushed the context-tripple-equals branch 3 times, most recently from 1abe1dd to 84f2700 Compare November 26, 2014 00:43
@jimfb jimfb force-pushed the context-tripple-equals branch from 84f2700 to 90d75ab Compare November 26, 2014 00:44
jimfb added a commit that referenced this pull request Nov 26, 2014
Warn if context values differ, related to issue #2
@jimfb jimfb merged commit aee73cc into facebook:master Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants