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

Consolidate common utils functions across the repo #54407

Open
matiasbenedetto opened this issue Sep 13, 2023 · 1 comment
Open

Consolidate common utils functions across the repo #54407

matiasbenedetto opened this issue Sep 13, 2023 · 1 comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@matiasbenedetto
Copy link
Contributor

matiasbenedetto commented Sep 13, 2023

What?

There are several common util functions, that are repeated across the repo that could, and probably should be consolidated.
One example of this is the functions that previously were imported from lodash package.

Why?

To avoid code repetition, reduce the bundle size, and reduce the potential error surface.

To optimize the bundle size, lodash was removed from Gutenberg but no alternative was provided for functions like _.get() or _.set(). For that reason, we have similar functions (example: search for getNestedValue() or setNestedValue()) across the repo that could be consolidated in one package that can be imported and reused by other modules.

More context

See this comment as example: #54161 (comment)

@matiasbenedetto matiasbenedetto added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Code Quality Issues or PRs that relate to code quality labels Sep 13, 2023
@tyxla
Copy link
Member

tyxla commented Sep 13, 2023

Thanks for bringing it up, @matiasbenedetto!

One more existing example that we should consolidate is getValueFromObjectPath(), and perhaps setImmutably().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

2 participants