Skip to content
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

Enhance the way we detect the cached page for lcp beacon script #6637

Open
1 of 4 tasks
wordpressfan opened this issue May 17, 2024 · 1 comment
Open
1 of 4 tasks
Labels
lcp type: enhancement Improvements that slightly enhance existing functionality and are fast to implement

Comments

@wordpressfan
Copy link
Contributor

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version Yes
  • Used the search feature to ensure that the bug hasn’t been reported before Yes

Describe the bug
Based on this PR: #6610

We agreed to merge it as it is and open another issue to mention the cases we need to handle to enhance this PR's code.

  • We can see in some cases we don't serve cache files mainly as a compatibility with some hosting companies so the cache is served from the hosting company not from our side, for this case we may consider clearing the page cache for the page that its lcp row was updated/created.
  • When the constant WP_ROCKET_WHITE_LABEL_FOOTPRINT is there we still add the Debug: cached here and we search for it in the new beacon here So we are fine here
  • @MathieuLamiot suggested to use the following strings instead of Debug: cached :
'<!-- Optimized for great performance'
OR
'<!-- This website is like a Rocket, isn't it? Performance optimized by '
  • Another suggestion is to add a class name or data attribute to any element (html, body, ...etc.) inside the cache file and use it, but again this will work only when we serve our cache (Check first point)

Additional context
Add any other context about the problem here.

Acceptance Criteria (for WP Media team use only)
Clear instructions for developers, to be added before the grooming

@wordpressfan wordpressfan added the type: enhancement Improvements that slightly enhance existing functionality and are fast to implement label May 17, 2024
@MathieuLamiot
Copy link
Contributor

@jeawhanlee mentioned here that sometimes Debug: cache is not present. This is why I suggested instead:

 '<!-- Optimized for great performance'
OR
'<!-- This website is like a Rocket, isn't it? Performance optimized by '

I don't know in which case this happens though. Maybe @jeawhanlee can explain? But there is a condition so I guess it can happen that Debug: cached is not there:

if ( ! empty( $time ) ) {
     $footprint .= ' - Debug: cached@' . $time;
}

@piotrbak piotrbak added the lcp label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lcp type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

No branches or pull requests

3 participants