-
Notifications
You must be signed in to change notification settings - Fork 820
Boost: Invalidate LCP when Cornerstone Page list is updated #43222
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
Conversation
… management - Introduced reset_and_analyze method to reset LCP data and reanalyze pages. - Added action hook for updating cornerstone pages list to trigger the new method. - Updated documentation to reflect changes and added versioning information.
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
- Consolidated LCP data reset and analysis into the reset_and_analyze method.
…/invalidate-cornerstone-list
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
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.
While testing this, I noticed that it sends requests to the cloud and analyses the LCP, but the UI is never updated.
Then I checked how Cloud CSS is handled and found this PR - https://github.com/Automattic/jetpack/pull/40009/files
I think it makes more sense to handle the re-analyze via the UI so we give the user feedback right away. Otherwise, they'd have to refresh the page to see that LCP was optimized again.
Nitpick: However, looking at the way Cloud CSS is handled, although simple, I wonder if it make sense to do it via the UI. That means that we're unable to do this via PHP. Ideally, we'd update the cornerstone pages list and dispatch a new LCP analysis via the back-end. Then at the same time, update the UI to a polling state. Though this seems clunky and I think we should stick with updating via the UI. If we decided that it's necessary to start the analysis via the back-end, we can always update it.
EDIT:
@LiamSarsfield I've updated the LCP analysis request to happen via the UI in 4a4aca0.
Take a look and tell me what you think.
…/invalidate-cornerstone-list
Good catch @dilirity, I took the majority of inspiration from Cache Preloading, but that didn't need a UI aspect to it, hence it wasn't needed.
I think this is okay for now as this is the only place where Cornerstone Pages are being updated, but we should be aware of UI side effects such as this if we ever do allow Cornerstone Pages to be updated elsewhere (unlikely though). |
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.
Note
Merge this PR after #43151 is merged.
Resolves HOG-82:Invalidate LCP when Cornerstone Page list is updated
Proposed changes:
Other information:
Jetpack product discussion
pc9hqz-3tr-p2
Does this pull request change what data or activity we track or use?
N/A
Testing instructions:
Prerequisites:
Jetpack Boost plugin installed and activated.
Boost Premium is set up.
LCP Optimization feature enabled.
Click here for SQL to check LCP State Option and Storage Posts
Testing Cornerstone Page List Update:
Note the current LCP state option value and any existing LCP storage posts. Pay attention to the data, and note the
post_modified_gmt
timestamps of the existing posts.Click here for SQL to check initial LCP State and Storage
Go to
Jetpack
->Boost
.Add, or remove a Cornerstone Page from the list. Note the approximate time of editing.
Wait a few seconds for the analysis to complete (it should be quick).
Re-check the
jetpack_boost_ds_lcp_state
option in thewp_options
table. Verify its value has been updated (it won't have a timestamp, but the content should reflect recent analysis).Re-check the
wp_posts
table forjb_store_lcp
posts. Verify that new posts now exist, and theirpost_date_gmt
orpost_modified_gmt
timestamps are after the time you activated the theme.Click here for SQL to check updated LCP State and new Storage posts
Verify that there is a record for the LCP Storage results for each valid Cornerstone from the list.