-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
chore: reducing duplicate if into single statement #22
Conversation
As I was reading through the code I noticed this, a minor improvement.
I noticed that this is done on a lot of components, I'll add the rest to this pull request when I find more time. |
Codecov Report
@@ Coverage Diff @@
## master #22 +/- ##
======================================
Coverage 94.6% 94.6%
======================================
Files 17 17
Lines 278 278
Branches 48 47 -1
======================================
Hits 263 263
Misses 15 15
Continue to review full report at Codecov.
|
Some uglifiers don't remove this code in production if you don't make it a dev check, so when adding the && Judging from the bundlesize output, terser is handling this correctly. Note that this was last time I checked. To come back to the "it seems to happen in a lot of components", it will be in the three hooks and the three components probably. UPDATE: this seems resolved, probably was an issue with the old webpack uglifier, so seems a really good PR. Thanks again for the great work! |
I've put up a pull request to add @Pruxis! 🎉 |
Hmhm, I haven't tested this on older uglifiers but have never had issues with Terser & babel-uglify that's default in CRA at this point. I don't have a lot of free time to test this thoroughly tho |
No worries, I'll take the testing on me. Just saying but avoid using babel-minify this can cause some nasty performance downgrades in React. Also this PR has no expiry date, not a crucial feature or anything just fun to give people quality. |
Thanks for helping out with this, I've implemented it myself but credits still go to you for noticing it! Thanks again for the wonderfull PR's |
As I was reading through the code I noticed this, a minor improvement.