Skip to content
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 _.groupBy() from compileCSS() #49227

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Mar 21, 2023

What?

This PR removes Lodash's _.groupBy() from compileCSS() in the style engine 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:

How?

We're using Array.prototype.reduce() instead.

Testing Instructions

  • Verify that as you move, change, duplicate or edit blocks, their custom styles still persist as expected.
  • Verify all checks are green - the changes are well covered by unit tests.

@tyxla tyxla added [Type] Performance Related to performance efforts [Type] Code Quality Issues or PRs that relate to code quality [Package] Style Engine /packages/style-engine labels Mar 21, 2023
@tyxla tyxla self-assigned this Mar 21, 2023
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@tyxla tyxla merged commit 37d604d into trunk Mar 22, 2023
@tyxla tyxla deleted the refactor/compile-css-group-by-lodash branch March 22, 2023 08:59
@github-actions github-actions bot added this to the Gutenberg 15.5 milestone Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Style Engine /packages/style-engine [Type] Code Quality Issues or PRs that relate to code quality [Type] Performance Related to performance efforts
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants