This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Invalidate script data cache when site URL, scheme, or plugin name changes #10278
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
opr
added
status: needs review
type: bug
The issue/PR concerns a confirmed bug.
focus: blocks
Specific work involving or impacting how blocks behave.
labels
Jul 19, 2023
woocommercebot
requested review from
a team and
wavvves
and removed request for
a team
July 19, 2023 15:58
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.36 MB ℹ️ View Unchanged
|
wavvves
suggested changes
Jul 20, 2023
opr
force-pushed
the
fix/script-data-cache
branch
from
July 21, 2023 13:41
9516e14
to
7773fc9
Compare
This was referenced Dec 11, 2023
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. |
github-actions
bot
added
the
status: stale
Stale issues and PRs have had no updates for 60 days.
label
Jul 29, 2023
github-actions
bot
removed
the
status: stale
Stale issues and PRs have had no updates for 60 days.
label
Aug 2, 2023
wavvves
approved these changes
Aug 3, 2023
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
focus: blocks
Specific work involving or impacting how blocks behave.
type: bug
The issue/PR concerns a confirmed bug.
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.
This PR adds a hash to the value of the
woocommerce_blocks_asset_api_script_data
transient. The hash is constructed based on the site URL, plugin version, and plugin path.The plugin path is used to check whether we're loading from WC Core or the WC Blocks feature plugin.
This PR also introduces a new transient,
woocommerce_blocks_asset_api_script_data_ssl
. If the site is loaded using HTTPS the script data will be loaded from this transient, if it is loaded using HTTP it will get it from the original value.This is required because, if a site is accessible by both HTTP and HTTPS, the URLs to the scripts would be cached with whatever scheme was used when the value was cached. While uncommon it has the potential to break sites so I would prefer to be safe at the expense of additional database storage.
Fixes #10221
Other Checks
Testing
Automated Tests
User Facing Testing
Internal testing - Do not include in the Testing Notes
$this->disable_cache
tofalse
;wp_options
table search forWooCommerce Visibility
Performance Impact
Small increase in database storage due to new transient. This is an acceptable tradeoff because it prevents sites allowing access via HTTP and HTTPs from breaking based on who accesses the site first after the cache becomes invalid.
Changelog