-
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
Global styles: resolve dynamic refs #43249
Conversation
Size Change: -35 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
Thanks for testing @MaggieCabrera There's also an error when I select the background color control. It makes me think we need to deal with these value at a higher level, either the point at which we first parse incoming theme settings in the JS or on the server 🤷 What do you reckon? |
The editor did not correctly resolve dynamic refs and the style engine does not yet support resolution. This commit adds a utility function to resolve dynmamic refs and add conditions to prevent recursive refs.
…k with a string value, albeit empty.
8510bb2
to
7e71b16
Compare
Yeah, I think it makes sense that the frontend just gets values that need to be resolved but that we know are correct beforehand |
Closing this. A bit stale and there doesn't appear to be an immediate need. |
What?
A follow up for #43166
Why?
To clean up how we resolve dynamic refs in the editor, remove duplicated code.
Also, because the style engine doesn't yet handle dynamic refs, moving the logic outside the
getCSSRules
loop.margin
and probably some other props were being skipped because of this.How?
This commit adds a utility function to resolve dynamic refs and add conditions to prevent recursive refs.
Testing Instructions
I'm using empty theme to test!
Here is some test theme.json
What we want to do is make sure the editor styles in
.editor-styles-wrapper
are displayed as they are on the frontend.You'll see a PHP warning:
This is expected because of the recursive reference.
Check that the test case in #43166 is still valid. That is, make sure the editor doesn't crash. 😄
Run the tests!
npm run test:unit