-
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: Remove _.mapValues()
from various blocks
#49637
Conversation
Size Change: +57 B (0%) Total Size: 1.37 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.
Thank you, @tyxla! I haven't run this, but code-wise it LGTM! 👍
return toWidthPrecision( newWidth ); | ||
} ); | ||
return Object.fromEntries( | ||
Object.entries( getColumnWidths( blocks, totalBlockCount ) ).map( |
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.
Note: getColumnWidths
will always return an object, assuming it doesn't throw.
if ( selectionRowIndex && selectionRowIndex !== rowIndex ) { | ||
return row; | ||
return Object.fromEntries( | ||
Object.entries( tableSections ).map( ( [ sectionName, section ] ) => { |
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.
Note: tableSections
will always be an object at this point.
Thanks for double-checking for errors, @sgomes! I've just added a last-minute fix to actually properly clean up nested object values. |
Flaky tests detected in ec78782. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4629860693
|
What?
This PR removes Lodash's
_.mapValues()
from a few of the core blocks.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 using
Object.fromEntries( Object.entries().map() )
as a replacement, with nullish coalescing to an empty object when the input may not be declared.Much of the PR is actually whitespace, so you could review it easier by disabling whitespace.
Testing Instructions
textDecoration: strikethrough
typography setting set is properly being migrated toline-through
.