Skip to content

Change DEV-only invariants to be warnings #11630

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 2 commits into from
Nov 22, 2017

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 22, 2017

Fixes #11618.

It's confusing to have two different code paths due to throwing in DEV but not in PROD. We try to avoid such cases.

I found these two as I was working on #11616.

They were introduced accidentally in 4d81744. In the past they would always run.

I thought about moving them out of the __DEV__ block but then figured there's no real need to run those extra checks in production. (We didn't for a few months anyway.) In particular it's nice to not run isArray checks for every single state object.

So we might as well turn them into warnings and keep them DEV-only.

Note: if we merge this, we’ll need to enable these warnings on next sync.

@gaearon gaearon merged commit 913a125 into facebook:master Nov 22, 2017
@gaearon gaearon deleted the no-dev-only-invariants branch November 22, 2017 18:59
raphamorim pushed a commit to raphamorim/react that referenced this pull request Nov 27, 2017
* Change DEV-only invariant about instance.state type to a warning

* Change DEV-only invariant childContextTypes check to a warning
Ethan-Arrowood pushed a commit to Ethan-Arrowood/react that referenced this pull request Dec 8, 2017
* Change DEV-only invariant about instance.state type to a warning

* Change DEV-only invariant childContextTypes check to a warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants