-
Notifications
You must be signed in to change notification settings - Fork 219
Performance: Cache script data in a transient for production builds #9120
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.1 MB ℹ️ View Unchanged
|
@mikejolley might be unrelated, but ran the E2E several times, and everytime all 5 failed. The errors are common flaky test output I've seen on other branches, but usually we don't get an 100% failure rate 🤔 |
77638fe
to
bc6fb8e
Compare
Any ideas @wavvves ? I can't see anything that would break tests but clearly something is up :/ |
The output seems to have changed, and now has some complaints about undefined array entries bringing up the env. I have some urgent tasks to get going right now, but we can pair during this week on this 👍🏼 |
8df495e
to
e17a317
Compare
Still can't work this out @wavvves Gonna leave it until next cooldown. |
I'm clueless also. Yes, after wrapping templates up, I'll assist on this during the cooldown and see what might be interfering with tests |
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
Converting this PR to draft, feel free to revert once it's ready for review. |
a33460d
to
74bf448
Compare
All fixed! Ready for review. |
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
* Revert "Performance: Cache script data in a transient for production builds" (#10509) * Revert "Performance: Cache script data in a transient for production builds (#9120)" This reverts commit 6b9955d. * fix WordPress version * fix version * update version to 10.6.5 * update changelog and testing instructions * update zip link * fix changelog --------- Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Adds caching to asset src, dependencies, and file version lookups to prevent the same data being requested on each page load. Values are stored in transients, and invalidated when the plugin package version increases. Development builds are excluded from caching to prevent issues when developing blocks.
Fixes #8796
Testing
Automated Tests
User Facing Testing
Mainly testing for regressions, so check that frontend scripts load correctly and existing blocks continue to function. Note; development builds do not use the cache.
npm run start
for a development build.npm run build
for a production build.To see the contents of the transient, when running a production build (and assuming you are using WP Local), open database > adminer and check the wp_options table for the option named
_transient_woocommerce_blocks_asset_api_script_data
. It should contain JSON containing the list of assets/dependencies etc.WooCommerce Visibility
Performance Impact
Positive; unsure how to get accurate metrics, but in limited testing with query monitor, a few seconds were shaved off of page load times. The original issue claimed 10% improvement.
Changelog