-
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 _.every()
in block editor
#44892
Conversation
Size Change: +32 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
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.
Thanks!
Have you checked if we need to check if the array is set in the changed places? Because I quickly tested and lodash would handle that(every( undefined, () => true )
). If yes let's 🚢 , If not it's a small change to make :)
Thanks for taking a look! In 2f0b910 I've tightened up one instance just in case, but the rest are good and will always be called on arrays 👍 Also |
What?
This PR removes Lodash's
_.every()
from the block editor. There are just a few usages and conversion is pretty straightforward.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?
We're replacing a few usages with a simple native
.every()
.Testing Instructions