This was reported in woocommerce/woocommerce#24590
Blocks requires certain settings/data to function, and this needs to be present anywhere a block may be used (so admin and frontend, regardless of user type). This is output to JSON inline on every page load.
This can be problematic if doing large queries such as getting terms, and counting post types.
Currently, the JSON is generated in Assets.php here:
https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/master/src/Assets.php#L86-L123
Most of this is harmless, with the exception of:
- get_terms - this is querying all categories in the store and generating links for each.
- wp_count_posts - less intensive but could still be cached.
We should look at either caching this data, using APIs instead as needed instead of grabbing data that may not be used, or making some of this conditonal.