Code Monkey home page Code Monkey logo

Comments (6)

piotrbak avatar piotrbak commented on June 20, 2024 2

@MathieuLamiot @vmanthos Updated the AC

from wp-rocket.

MathieuLamiot avatar MathieuLamiot commented on June 20, 2024 1

@vmanthos, @Mai-Saad, @piotrbak: following Tabrisrp's investigation, he pointed out 2 issues. Would it be interesting to rework the acceptance criteria here? I might not understand everything, but it seems the AC cover the activation part (checking we send the right requests on activation), but not the RUCSS side-effect.
A few e2e scenarios might be needed to cover Tabrisrp's proposal?

from wp-rocket.

piotrbak avatar piotrbak commented on June 20, 2024

Acceptance Criteria:

1. When separate cache for mobiles is enabled when activating the plugin:

2. When separate cache for mobiles is enabled when clearing the Used CSS:

3. When separate cache for mobiles is disabled when activating the plugin:

  • We should send only desktop request

4. When separate cache for mobiles is disabled when clearing the Used CSS:

  • We should send only desktop request after clearing the cache

from wp-rocket.

Tabrisrp avatar Tabrisrp commented on June 20, 2024

@vmanthos When clearing the used CSS, did you do it from the admin side or from the front side via the admin bar?

The homepage preload is hooked on the used CSS clear, but only on the admin side.

from wp-rocket.

vmanthos avatar vmanthos commented on June 20, 2024

@Tabrisrp I cleared it using the admin bar menu item while in WP Rocket's dashboard.
I believe the same would happen if the theme is switched or the permalinks are changed.

from wp-rocket.

Tabrisrp avatar Tabrisrp commented on June 20, 2024

Reproduce the issue ✅

Reproduced

Identify the root cause ✅

There is 2 different parts in this issue, the activation one and the RUCSS clean one.

For the activation, we do a request to the homepage when activating, but we do not do the request for mobile.

For the RUCSS clean one, I noticed that we do have a method hooked on the related action, but right after in the truncate_used_css_handler() method, there is a call to rocket_clean_domain(), so the preload happens and is deleted right away.

There is only a cache file for the desktop version because there is a manual call to the homepage in the method after.

Scope a solution ✅

in WP_Rocket\Engine\Activation\Activation.php

  • remove the call to the homepage
  • add a new action rocket_after_activation

in WP_Rocket\Engine\Preload\Activation.php

  • Add the PreloadUrl controller as a dependency to the class
  • In the activate method, add a new add_action on rocket_after_activation, to preload the homepage
  • add a method preload_homepage(), which will call $this->preload_url->preload_url( home_url() );

in WP_Rocket\Engine\Optimization\RUCSS\Admin\Subscriber

  • Remove no longer necessary preload calls to the homepage in truncate_used_css_handler(), and truncate_used_css()
  • in truncate_used_css_handler(), switch the calls to $this->delete_used_css_rows(); and rocket_clean_domain(); to make sure the clean happens before the preload.

Estimate the effort ✅

Effort [S]

from wp-rocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.