-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Page Layout Picker: refresh page pattern cache when site lang changes #51087
New Page Layout Picker: refresh page pattern cache when site lang changes #51087
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Very nice fix!
Personally I think it could use a comment, I find the add_action
priorities starting from 10 not intuitive. What do you think?
apps/editing-toolkit/editing-toolkit-plugin/full-site-editing-plugin.php
Show resolved
Hide resolved
Works well for me 👍 There are a few e2e test fails which might be related. Are they referring to the former page picker?
|
Yeah I broke tests on |
The `get_verticals_locale()` method in `Starter_Page_Templates` depends on the `get_ios_639_locale()` helper function, so the module with that helper function needs to be executed first before we set up starter page templates.
The page pattern cache was keyed on the account language. However the account language isn't used when making the request to get the page pattern data. Switching to the site's language (i.e. the same locale slug used when fetching pattern data) means the cache will be invalidated correctly.
9ec100d
to
f548912
Compare
e2e tests are green 🦖 The php unit tests are failing because of this issue in |
Changes proposed in this Pull Request
get_iso_639_locale()
function is available when__construct()
is calledAfter changing the site language the layout names and categories in the page layout picker still show in the previous language. And when the pattern is inserted it inserts the pervious language. You'd have to wait a day after updating the site language before the picker would fix itself.
The problem is the pattern data is cached using a key that includes the account language, not the site language. This change makes sure the cache key is using the exact same locale slug that's being used in the query to get pattern data.
Testing instructions
install-plugin.sh etk update/refresh-page-pattern-cache-on-site-lang-change
on sandbox