GoogleForCreators / web-stories-wp

Web Stories for WordPress
https://wp.stories.google
Apache License 2.0
759 stars 179 forks source link

Performance: Improve `useAddPreset` hook #10705

Closed miina closed 1 year ago

miina commented 2 years ago

Feature Description

useAddPreset hook currently depends on selectedElements. In some cases, we only need the text elements information though, e.g. in case of dealing with Saved Styles.

This will be more relevant when https://github.com/GoogleForCreators/web-stories-wp/issues/10113 gets merged since that should re-render only if selection relevant to text elements changes.

We could probably split up the useAddPreset hook to have a separate hook for adding colors and one for adding styles.

Alternatives Considered

Additional Context

miina commented 2 years ago

@BrittanyIRL / @littlemilkstudio Is this issue something that Pea pod would be interested in taking? Since you've been tackling a bunch of performance issues recently.

It's mostly relevant to an issue I'm working on currently (#10113, should get merged in a few days) so happy to take it for us as well but wanted to ask just in case.

maxyinger commented 2 years ago

@miina Yea we'd be happy to grab this. Just started looking into the libraries panels more extensively yesterday, so this kinds lines up with that nicely