-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Lodash: Refactor away from edit-post
package
#48786
Conversation
Size Change: -5 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
2c5b5ea
to
b73fce6
Compare
b73fce6
to
d15ac33
Compare
'labels', | ||
'menu_name', | ||
] ) } | ||
label={ taxonomy.labels.menu_name } |
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.
We're already using taxonomy
as a non-nullish object here, and a valid taxonomy
entity record will always have a labels
object.
Flaky tests detected in d15ac33. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4345359173
|
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.
Thank you!
What?
This PR removes the remaining Lodash from the
@wordpress/edit-post
package.Why?
Lodash is known to unnecessarily inflate the bundle size of packages, and in most cases, it can be replaced with native language functionality. See these for more information and rationale:
@wordpress/api-fetch
package haslodash
as a dependency #39495How?
Usages are straightforward. We're using direct access instead of
_.get()
, coupled with optional chaining where necessary. We're usingObject.fromEntries( Object.entries().map() )
instead of_.mapValues()
andArray.prototype.length
instead ofisEmpty()
sincefills
in theSlot
callback are always provided as an array.Testing Instructions