Prevent prefetched Cart payload causing wrong values with cached Mini-Cart block #10029
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
assets/js/blocks/mini-cart/test/block.js
|
Size Change: +64 B (0%) Total Size: 1.18 MB
ℹ️ View Unchanged
|
@@ -150,12 +150,10 @@ window.addEventListener( 'load', () => { | |||
}; | |||
|
|||
const openDrawerWithRefresh = () => { | |||
miniCartBlock.dataset.isDataOutdated = 'true'; |
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.
This change is not directly related to the rest of the PR, but I found out that isDataOutdated
was defined but never read, so it should be safe to remove it.
I am still seeing a flash of the old data in some cases. file.movSteps to replicate:
|
f045b2c
to
f906b81
Compare
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.
Thanks for the quick fix, it is working great now. Good job!
In #9493, we updated the Mini-Cart block to support caching plugins. However, there was still an issue when hovering the button: cached values were displayed for a small period of time. That was caused by the prefetching we did of the
/cart/
endpoint, this PR removes that and updates the Mini-Cart block button to always display the correct values.Testing
User Facing Testing
With your admin user:
In a private/incognito window without being logged in:
With your admin user:
WooCommerce Visibility
Changelog