Skip to content
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

Do not mix production and development version of create-react-class #1012

Merged
merged 1 commit into from
Nov 17, 2017

Conversation

amanmahajan7
Copy link
Contributor

@amanmahajan7 amanmahajan7 commented Nov 9, 2017

Description

Fix false positive getDefaultProps warnings. Fixed #978

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
React 15.5 deprecated React.createClass and added a warning when getDefaultProps() method is used with class components (React.component). These deprecation warnings are only shown in development mode. Components created using React.createClass or createReactClass still use getDefaultProps() method to define defaultProps. In development mode, React sets a flag isReactClassApproved to suppress these warnings for components created using React.createClass or createReactClass.
react-data-grid.js bundles the min version of create-react-class (created using webpack) and because of this isReactClassApproved flag is not set anymore on the components created using using React.createClass or createReactClass.

What is the new behavior?
react-data-grid.js bundles the dev version of create-react-class
react-data-grid.min.js bundles the min version of create-react-class

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:
This is a temporary fix, in the future when mixins are removed, remaining components can be converted to class components and create-react-class package can be dropped

@amanmahajan7 amanmahajan7 requested a review from malonecj November 9, 2017 00:07
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e350009 on am-fix-defaultprops-warnings into ** on master**.

@jpdriver
Copy link
Contributor

jpdriver commented Nov 9, 2017

@amanmahajan7 what impact does this have on bundle size? 😳

@amanmahajan7 amanmahajan7 changed the title Do not mix production and development version of create-react-class [WIP] Do not mix production and development version of create-react-class Nov 9, 2017
@amanmahajan7
Copy link
Contributor Author

amanmahajan7 commented Nov 9, 2017

@jpdriver, it does not change the bundle size by much, previously create-react-class was included by webpack, this PR includes it explicitly so we can control which version gets packaged.

Before
image

After
image

@amanmahajan7 amanmahajan7 changed the title [WIP] Do not mix production and development version of create-react-class Do not mix production and development version of create-react-class Nov 9, 2017
@audiolion
Copy link

+1 for this, getting all the warnings is pretty annoying

@stevewillard
Copy link

Any reason why this can't be merged?

@malonecj malonecj merged commit b03da75 into master Nov 17, 2017
malonecj added a commit that referenced this pull request Nov 17, 2017
malonecj added a commit that referenced this pull request Nov 17, 2017
…-class" (#1023)

* Revert "Version bump to 2.0.75 [ci skip]"

This reverts commit 5926144.

* Revert "Do not mix production and development version of create-react-class (#1012)"

This reverts commit b03da75.
@amanmahajan7 amanmahajan7 deleted the am-fix-defaultprops-warnings branch November 20, 2017 14:46
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.

Getting getDefaultProps warnings with react 15.6+
6 participants