-
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 Style Context: Consider global user styles ready if a theme has none #46073
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
packages/edit-site/src/components/global-styles/global-styles-provider.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/global-styles-provider.js
Outdated
Show resolved
Hide resolved
Size Change: +38 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
@youknowriad, let me know if you prefer a different solution here. |
'globalStyles', | ||
_globalStylesId | ||
) | ||
: undefined; |
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.
Can we instead rely on the "isResolving state" of both these two resolvers to mark it ready (instead of checking active themes).
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 also had that idea; I will test how it works in practice.
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.
Update the logic to use resolvers 69f0c34.
d8aebdd
to
69f0c34
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.
LGTM 👍
What?
Fixes #45862.
Also, see #46054.
Report on trac: https://core.trac.wordpress.org/ticket/57193
PR fixes checks for
isUserConfigReady
and marks the config ready state astrue
when a theme has no global user styles.Why?
The block themes and now themes that use block-based template parts don't strictly require a
theme.json
file to access the Site Editor. However, after recent performance improvements aroundtheme.json
methods, the global user styles query bails early if a theme doesn't support this file.This caused the global styles
isReady
state to be false for such themes and prevented Site Editor from rendering.How?
I adjusted the
isReady
condition inuseGlobalStylesUserConfig
to account for themes that can access Site Editor but don't supporttheme.json
.Testing Instructions
theme.json
file.