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

Refactor clean RUCSS/Critical images dashboard button #6334

Conversation

remyperona
Copy link
Contributor

Description

Refactor the code for the clean RUCSS/Critical images dashboard button, moving it from hardcoded in the template to an action and a callback

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Checklists

Generic development checklist

  • My code follows the style guidelines of this project, with adapted comments and without new warnings.

@remyperona remyperona requested a review from a team December 15, 2023 19:30
@remyperona remyperona self-assigned this Dec 15, 2023
@remyperona remyperona added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement lcp labels Dec 15, 2023
@remyperona remyperona added this to the 3.16 milestone Dec 15, 2023
@remyperona remyperona changed the base branch from develop to feature/lcp-above-the-fold-optimization December 15, 2023 19:31
@Mai-Saad
Copy link
Contributor

Mai-Saad commented Dec 18, 2023

@Tabrisrp Thanks for the PR. Please find exploratory test notes about clear critical images below. (note, the same points already exist on the base branch)
1- When click clear critical images, we get the following fatal error (we will have same error if we click clear used css from admin )

[18-Dec-2023 07:23:21 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function WP_Rocket\Engine\Saas\Admin\apply_filter() in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/Saas/Admin/Clean.php:26
Stack trace:
#0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/Saas/Admin/Subscriber.php(97): WP_Rocket\Engine\Saas\Admin\Clean->clean_saas()
#1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): WP_Rocket\Engine\Saas\Admin\Subscriber->clean_saas()
#2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/admin-post.php(85): do_action()
#5 {main}
  thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/Saas/Admin/Clean.php on line 26

2- clear critical image for this URL is displayed at each admin page
Screenshot from 2023-12-18 09-21-47
Screenshot from 2023-12-18 09-21-37
3- When click clear critical images, we will have this deprecated notice
[18-Dec-2023 07:23:21 UTC] PHP Deprecated: Creation of dynamic property WP_Rocket\Engine\Optimization\RUCSS\Controller\UsedCSS::$optimize_url_context is deprecated in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/Optimization/RUCSS/Controller/UsedCSS.php on line 106 => same notices when clear and preload cache

@Mai-Saad
Copy link
Contributor

Mai-Saad commented Dec 26, 2023

@Tabrisrp Thanks for the update. using commit id 5253856
1- Here, no deprecated notice nor fatal error now 🎉 but when clicking clear critical images, admin keeps loading sign in the browser tab, and nothing cleared from the database => if RUCSS is enabled, clear used CSS won't reflect on database nor file system as well
2- Clear critical image for this URL still displayed on non-related pages => if RUCSS is enabled, clear used CSS for this URL will be displayed on non-related pages as well
Screenshot from 2023-12-26 14-19-00
Note: Exploratory Test done on https://newer.rocketlabsqa.ovh/

@remyperona
Copy link
Contributor Author

Thank you, the latest commits should fix the 2 issues reported.

@remyperona remyperona requested a review from jeawhanlee January 2, 2024 22:01
@Miraeld Miraeld self-requested a review January 3, 2024 03:10
@Mai-Saad
Copy link
Contributor

Mai-Saad commented Jan 8, 2024

@Tabrisrp Thanks for the update.

  • Now clear critical images for this URL is displayed to post(view), page(view/edit), product (edit/view) and media (view/edit) but it is displayed now at private post while it shouldn't as same as with rucss
  • Clear critical images now is clearing the critical images so no loop, but in this case we shall clear cache as same as with RUCSS (Clear critical images shall interact as same as clear used css in terms of cache clear).

@remyperona
Copy link
Contributor Author

Both points should be fixed now

@Mai-Saad
Copy link
Contributor

@Tabrisrp Thank you, Working fine now 🎉

@remyperona remyperona merged commit fcd6b46 into feature/lcp-above-the-fold-optimization Jan 15, 2024
2 of 7 checks passed
@remyperona remyperona deleted the task/refactor-dashboard-button branch January 15, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants