This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Only print wp.apiFetch.createPreloadingMiddleware() when needed #8647
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aljullu
added
status: needs review
focus: performance
The issue/PR is related to performance.
block: cart
Issues related to the cart block.
block: checkout
Issues related to the checkout block.
type: technical debt
This issue/PR represents/solves the technical debt of the project.
block: mini-cart
Issues related to the Mini-Cart block.
labels
Mar 6, 2023
woocommercebot
requested review from
a team and
imanish003
and removed request for
a team
March 6, 2023 15:03
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
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
|
@Aljullu not tested this, but the code change looks sound and makes sense 👍🏻 |
imanish003
approved these changes
Mar 8, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested the changes, and it's working as expected. LGTM 🚀
This was referenced Mar 8, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: cart
Issues related to the cart block.
block: checkout
Issues related to the checkout block.
block: mini-cart
Issues related to the Mini-Cart block.
focus: performance
The issue/PR is related to performance.
type: technical debt
This issue/PR represents/solves the technical debt of the project.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #7176 (this specific PR doesn't reduce the number of requests of the Mini Cart block, but might pave the way to do so in the future).
In some pages, we were printing a script that called
wp.apiFetch.createPreloadingMiddleware()
even if the array of requests to preload was empty. This PR refactors that code so that function is only called if there is something to preload.@mikejolley I would appreciate your review as well as this PR is closely related to #5022.
Testing
User Facing Testing
This PR shouldn't produce any changes, so testing is focused on making sure there are no regressions:
fetch
requests towc/store/cart
in the Network tab of your browser devtools (you can open them with F12).Testing stale data:
Some of these steps have been copied and adapted from #5022.
WooCommerce Visibility
Changelog