Rendering style variation tiles is really really slow when the site has large assets #51175
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Performance
Related to performance efforts
Description
The style variation tiles can be really slow to render if your site includes lots of assets. This is similar to #49645 but this issue is not specific to fonts.
Step-by-step reproduction instructions
If you right-click on one of the tiles and inspect it with your browser tools you will see that each style tile is rendered by an iframe and that it includes lots of different assets. Most of which are overkill for a style tile. Notably it will include
<style id="wp-fonts-jetpack-google-fonts">
even though it only ever renders one font - the h1 font for that style variation.The style tile is displayed by the StylesPreview component, which renders a GB iframe. It's the GB iframe that outputs the styles it gets from __unstableResolvedAssets in the block-editor store. This comes from the script-loader settings.
Screenshots, screen recording, code snippet
Screen.Recording.2023-06-01.at.16.05.57.mov
Screen recording shows asset-heavy GB on the left, and vanilla GB on the right. Notice that despite a ~2 second headstart, the asset heavy GB finishes rendering after the vanilla GB.
The aubergine tile for the asset-heavy window is about 950kb, the aubergine tile in the vanilla window is 35kb, comparing the two sources, it seems that difference is basically entirely in the fonts asset downloaded in the asset-heavy window.
Environment info
The site is using WordPress 6.2.2 using GB 15.9 and TT3
I've reproduced on chrome 113.0.5672.126 and firefox 113.0.2
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: