-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use a context provider for global styles config #35622
Conversation
Size Change: +25 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
822fcfd
to
7e088b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things seem to work well on my tests 👍
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
useStyle
oruseSetting
2- Decouple the Global Styles components from the data provider, meaning we could show alternative global styles previews for instance. (Enable #35619)
Testing instructions