-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
GlobalStyles hooks: do not smart merge presets in useGlobalSetting #47415
Conversation
Size Change: -25 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2fd03c2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4004627287
|
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.
The changes look good to me and things worked well on my tests 👍
@@ -46,10 +43,10 @@ function ScreenBackgroundColor( { name, variationPath = '' } ) { | |||
const hasBackgroundColor = | |||
supports.includes( 'backgroundColor' ) && | |||
isBackgroundEnabled && | |||
( solids.length > 0 || areCustomSolidsEnabled ); | |||
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled ); |
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.
Nice change the useColorsPerOrigin hook already includes only not empty origins so we can just rely on it 👍 .
Nice! |
Extracted from #47356
What?
This PR removes the automatic computation of the presets from useGlobalSetting hook.
Why?
There are several reasons for this change:
How?
Note: There's another "smart" behavior that I'd like to remove from
useGlobalStyle
this time which is the automatic "decoding" of the styles (from CSS vars or the preset format to actual values). The reasoning is similar, consumers and producers of global styles should be able to know the original value and act accordingly. That one is going to be done by steps though as it's more impactful.Testing Instructions
1- Open the global styles panel and try to use and edit presets (colors, gradients, fontSizes, fontFamilies)