Use a context provider for global styles config#35622
Merged
Merged
Conversation
|
Size Change: +25 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
822fcfd to
7e088b9
Compare
oandregal
approved these changes
Oct 14, 2021
oandregal
left a comment
Member
There was a problem hiding this comment.
I think I've tested all code paths:
- user changes some style
- user changes the value of some color in the palette
- user adds a new color to the palette
and it works as expected.
In terms of performance, I've throttled x6 my CPU. In trunk the changes took almost 2 seconds to be rendered while in this branch it was a matter of ms.
jorgefilipecosta
approved these changes
Oct 14, 2021
jorgefilipecosta
left a comment
Member
There was a problem hiding this comment.
Things seem to work well on my tests 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Folllow up to #35264
This reintroduces the global styles context provider (splits hooks into provider hooks and consumer hooks), there are two major reasons for this change:
1- Performance: we only parse and fetch global styles once and not each time we use
useStyleoruseSetting2- Decouple the Global Styles components from the data provider, meaning we could show alternative global styles previews for instance. (Enable #35619)
Testing instructions