-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Optimize exports of the wp/compose package #17945
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { flowRight as compose } from 'lodash'; | ||
|
||
/** | ||
* Composes multiple higher-order components into a single higher-order component. Performs right-to-left function | ||
* composition, where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @param {...Function} hocs The HOC functions to invoke. | ||
* | ||
* @return {Function} Returns the new composite function. | ||
*/ | ||
export default compose; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,20 +1,8 @@ | ||||||
/** | ||||||
* External dependencies | ||||||
*/ | ||||||
import { flowRight } from 'lodash'; | ||||||
|
||||||
// Utils | ||||||
export { default as createHigherOrderComponent } from './utils/create-higher-order-component'; | ||||||
|
||||||
/** | ||||||
* Composes multiple higher-order components into a single higher-order component. Performs right-to-left function | ||||||
* composition, where each successive invocation is supplied the return value of the previous. | ||||||
* | ||||||
* @param {...Function} hocs The HOC functions to invoke. | ||||||
* | ||||||
* @return {Function} Returns the new composite function. | ||||||
*/ | ||||||
export { flowRight as compose }; | ||||||
// Compose helper (aliased flowRight from Lodash) | ||||||
export { default as compose } from './higher-order/compose'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Was there a reason this couldn't be the following? Would it hinder tree shaking?
Suggested change
I'm not requesting this be changed, it seems fine to me as-is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that would also work. I tried to make the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to learn more as well. I'm fine leaving it as is but at the same time I can't figure out why it would make a difference. |
||||||
|
||||||
// Higher-order components | ||||||
export { default as ifCondition } from './higher-order/if-condition'; | ||||||
|
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 looked for any things in this package that would violate
sideEffects
and didn't find any 👍source