-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Remove lodash.throttle and replace underscore calls with lodash #5946
Conversation
aa56827
to
37d4d27
Compare
37d4d27
to
48f683b
Compare
Codecov Report
@@ Coverage Diff @@
## master #5946 +/- ##
==========================================
- Coverage 63.58% 63.56% -0.02%
==========================================
Files 393 393
Lines 23674 23661 -13
Branches 2639 2639
==========================================
- Hits 15053 15041 -12
+ Misses 8608 8607 -1
Partials 13 13
Continue to review full report at Codecov.
|
@@ -10,12 +9,6 @@ import { | |||
} from '../../../src/modules/utils'; | |||
|
|||
describe('utils', () => { | |||
it('slugify slugifies', () => { |
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.
can we still rewrite but keep this test case?
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 tested stubbing Superset's slugify
implementation with kebabCase
from lodash
and it passes all test cases under this it
except one.
kebabCase
: "camelCase"
=> "camel-case"
slugify
: "camelCase"
=> "camelcase"
This was the only difference. IMO, I am leaning towards switching to lodash
's kebabCase
which is well-tested library and industry standard than custom implementation and then remove slugify
from codebase.
I checked where the function slugify
is being used and it is used for creating tooltip id
string. My understanding is this is harmless change, so I made the move for it. Please correct me if I misunderstood.
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.
it used in creating customized url. for example /superset/dashboard/homesmetrics/
.
can you make sure existed slugged dashboard url work?
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 think url is generated by python slugify function...so this JS version is just "tooltip". so it really didn't matter much.
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.
LGTM
Thank you. Please merge when you are ready. |
…he#5946) * remove lodash.throttle from dependency * add babel-plugin-lodash' * use lodash instead of underscore for isFunction * switch underscore to lodash * switch from underscore to lodash flatten * Remove slugify and use kebabCase from lodash instead
lodash.throttle
from dependency since there is nowlodash
.babel-plugin-lodash
that helps optimize bundle output by taking only necessary part from lodash instead of the entire bundle.https://github.com/lodash/babel-plugin-lodash
underscore
calls withlodash
where applicable.@williaster @xtinec @conglei