Lodash: Remove more _.isEmpty() from block editor#51098
Conversation
|
Size Change: -5 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
The colors argument is expected to be an array:
There was a problem hiding this comment.
Colors are expected to be an array in both tests and theme.json:
https://developer.wordpress.org/themes/advanced-topics/theme-json/#color-palette
There was a problem hiding this comment.
Colors are expected to be an array in both tests and theme.json:
https://developer.wordpress.org/themes/advanced-topics/theme-json/#color-palette
There was a problem hiding this comment.
Gradients are expected to be an array in both tests and theme.json:
https://developer.wordpress.org/themes/advanced-topics/theme-json/#color-palette
There was a problem hiding this comment.
Gradients are expected to be an array in both tests and theme.json:
https://developer.wordpress.org/themes/advanced-topics/theme-json/#color-palette
There was a problem hiding this comment.
Colors are expected to be an array in both tests and theme.json:
https://developer.wordpress.org/themes/advanced-topics/theme-json/#color-palette
There was a problem hiding this comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
Selectors, if defined, will be an object:
https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#selectors
There was a problem hiding this comment.
Super nit: ? in blockType?.selector at the second check is not needed.
There was a problem hiding this comment.
Super nit: ? in blockType?.selector at the second check is not needed.
dd0de89 to
262c8db
Compare
|
Flaky tests detected in 262c8db. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5143262280
|
* Lodash: Remove more _.isEmpty() from block editor * Remove unnecessary boolean check * Remove unnecessary optional chaining
What?
This PR removes Lodash's
_.isEmpty()from the block editor 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-fetchpackage haslodashas a dependency #39495How?
We're checking if the props are truthy, and if they are, we verify that it's not an empty object by using
Object.keys().length.Testing Instructions