-
Notifications
You must be signed in to change notification settings - Fork 930
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
fix: treeshake Downshift and useSelect #850
Conversation
const validatePropTypes = | ||
process.env.NODE_ENV === 'production' | ||
? noop | ||
: getPropTypesValidator(useSelect, propTypes) |
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.
I rather recommend to use a condition in useSelect
as in this case validatePropTypes
function will be unused and removed:
if (process.env.NODE_ENV !== 'production') {
validatePropTypes(userProps)
}
5107ea7
to
b8ed39f
Compare
@all-contributors please add @layershifter with code, infra, ideas |
@silviuavram I've put up a pull request to add @layershifter! 🎉 |
@all-contributors please add @epiqueras with ideas |
@silviuavram I've put up a pull request to add @epiqueras! 🎉 |
Codecov Report
@@ Coverage Diff @@
## master #850 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 9 8 -1
Lines 724 702 -22
Branches 156 158 +2
=====================================
- Hits 724 702 -22
Continue to review full report at Codecov.
|
🎉 This PR is included in version 3.4.8 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
defaultProps
andstateChangeTypes
prevent Downshift from being tree-shakeable. Also the prop type checks inuseSelect
.Use
no-side-effect-class-properties
in.babelrc.js
along with the original configs fromkcd-scripts
. https://github.com/naver/babel-plugin-no-side-effect-class-properties @kentcdodds maybe you want to include this as well or mark it to be added once a more official version is released.Updated
rollup.config.js
to use the babel config file.Only check hook prop-types if not on production.
Result: treeshakeable Downshift.
Most grateful to @layershifter for contributing with this.
babel/babel#8592
babel/babel#6963