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.
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 forgetNestedValue()
orsetNestedValue()
) 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: https://github.com/WordPress/gutenberg/pull/54161#discussion_r1321492693