Opened 16 months ago
Closed 3 months ago
#62261 closed enhancement (maybelater)
Theme JSON: cached resolved URIs
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Themes | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Focuses: | Cc: |
Description
A ticket to track the syncing of Gutenberg PR: https://github.com/WordPress/gutenberg/pull/66155
What
Implement "pretty basic caching" for resolved theme URIs in WP_Theme_JSON_Resolver::get_resolved_theme_uris.
The intention to improve performance, even if slightly.
WP_Theme_JSON_Resolver::get_resolved_theme_uris, and WP_Theme_JSON_Resolver::resolve_theme_file_uris which calls it, is fired multiple times in a single session to:
- Generate styles
- Deliver resolved URIs in a global styles controller response.
Results will become more pronounced as other relative paths are introduced, e.g., fonts, and more blocks support background images.
Cached data is not be stored persistently across page loads.
Change History (5)
This ticket was mentioned in PR #7596 on WordPress/wordpress-develop by @ramonopoly.
16 months ago
#1
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
12 months ago
#3
@
12 months ago
- Milestone changed from 6.8 to Future Release
Given the Gutenberg PR is not on the 6.8 project board, let's move this ticket to Future Release.
@ramonopoly commented on PR #7596:
3 months ago
#4
Closing as stale.
Syncing https://github.com/WordPress/gutenberg/pull/66155
Trac ticket: https://core.trac.wordpress.org/ticket/62261
## What?
Implement "pretty basic caching" for resolved theme URIs in
WP_Theme_JSON_Resolver::get_resolved_theme_uris.## Why?
The intention to improve performance, even if slightly.
WP_Theme_JSON_Resolver::get_resolved_theme_uris, andWP_Theme_JSON_Resolver::resolve_theme_file_uriswhich calls it, is fired multiple times in a single session to:Here are some preliminary results (higher response time is worse):
|
|
|
Results will become more pronounced as other relative paths are introduced, e.g., fonts, and more blocks support background images.
Cached data is not be stored persistently across page loads.
## How?
Simple object caching.
## Testing Instructions
Run
npm run test:unit:php:base -- --filter WP_Theme_JSON_Resolver_Gutenberg_TestCreate a theme.json with background image paths defined for several blocks.
Ensure these appear as expected in the editor and frontend.
In the theme.json file, replace one or several paths with new asset paths. Check that the styles have been updated and the editor/frontend looks good.
Here is some test JSON based on current assets in TT5: