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

Components: Refactor ExternalLink away from Lodash #42341

Merged
merged 2 commits into from
Jul 12, 2022

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Jul 11, 2022

What?

This PR removes all of the Lodash from the ExternalLink component. 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:

How?

We have to deal essentially a couple of methods, and migration away from them is pretty straightforward:

compact()

We're replacing it with a filter( Boolean ).

uniq()

We're replacing it with [ ...new Set( originalArray ) ].

Testing Instructions

  • Start storybook: npm run storybook:dev
  • Open ExternalLink
  • Verify you still have the rel attribute as before in the demo.

@tyxla tyxla added [Type] Performance Related to performance efforts [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Jul 11, 2022
@tyxla tyxla requested a review from ajitbohra as a code owner July 11, 2022 18:08
@tyxla tyxla self-assigned this Jul 11, 2022
@tyxla tyxla force-pushed the refactor/external-link-lodash branch from 6eba462 to 5afe649 Compare July 12, 2022 09:23
@tyxla tyxla force-pushed the refactor/external-link-lodash branch from 5afe649 to e19ab83 Compare July 12, 2022 09:24
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

🚀

@tyxla tyxla merged commit 7d5e47d into trunk Jul 12, 2022
@tyxla tyxla deleted the refactor/external-link-lodash branch July 12, 2022 10:25
@github-actions github-actions bot added this to the Gutenberg 13.7 milestone Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [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.

2 participants