-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Preload: fix multiple regressions around global styles #7661
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
Changes from 1 commit
542261e
4f3644c
8c90aae
530adb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,8 @@ static function ( $classes ) { | |
|
|
||
| $rest_path = rest_get_route_for_post( $post ); | ||
|
|
||
| $stylesheet = get_stylesheet(); | ||
|
|
||
| // Preload common data. | ||
| $preload_paths = array( | ||
| '/wp/v2/types?context=view', | ||
|
|
@@ -65,8 +67,10 @@ static function ( $classes ) { | |
| sprintf( '%s/autosaves?context=edit', $rest_path ), | ||
| '/wp/v2/settings', | ||
| array( '/wp/v2/settings', 'OPTIONS' ), | ||
| '/wp/v2/global-styles/themes/' . get_stylesheet(), | ||
| '/wp/v2/global-styles/themes/' . $stylesheet . '?context=view', | ||
| '/wp/v2/global-styles/themes/' . $stylesheet . '/variations?context=view' | ||
| '/wp/v2/themes?context=edit&status=active', | ||
| array( '/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id(), 'OPTIONS' ) | ||
| '/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id() . '?context=edit', | ||
ramonjd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on user capabilities, a different clientside request will fire, e.g., ✅ user can update global styles: 🔕 user cannot update global styles: So at the moment, editors will get a clientside request since I'm wondering if it's worth changing this to "view" context based on caps. Probably for a follow up, as this already fixes a bunch of unnecessary requests.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried that here just to test things out: |
||
| ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.