wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Cache is cleared for async features RUCSS & Load CSS Asynchronously upon activation

Open vmanthos opened this issue 2 years ago • 1 comments

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

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

Describe the bug

When activating the following features:

  • Remove Unused CSS
  • Load CSS Asynchronously

we clear the whole cache as we do when activating other features that affect the front-end.

Given that for Remove Unused CSS we are clearing the cache of a URL as soon as the used CSS has been created: https://github.com/wp-media/wp-rocket/blob/8ca1fb5bf5b67c0fe6e3b7087fa04e4e0efb4348/inc/Engine/Cache/PurgeActionsSubscriber.php#L53

and for Load CSS Asynchronously we clear the cache when the critical CSS generation process is complete: https://github.com/wp-media/wp-rocket/blob/8ca1fb5bf5b67c0fe6e3b7087fa04e4e0efb4348/inc/Engine/CriticalPath/Admin/Admin.php#L189

we don't need to clear the cache upon activating the two features.

To Reproduce N/A

Expected behavior

Do not clear the cache when activating Remove Unused CSS and Load CSS Asynchronously.

Screenshots N/A

Additional context N/A

Backlog Grooming (for WP Media dev team use only)

  • [ ] Reproduce the problem
  • [ ] Identify the root cause
  • [ ] Scope a solution
  • [ ] Estimate the effort

vmanthos avatar Aug 16 '22 05:08 vmanthos

Reproduce the issue :heavy_multiplication_x:

No need to reproduce

Scope a solution :white_check_mark:

after talking with @vmanthos we need to add remove_unused_css , async_css , optimize_css_delivery options in $removed array only if remove_unused_css OR async_cssare activated to not clean the cache domain after they are enabled

https://github.com/wp-media/wp-rocket/blob/b39567786ccc5c321ace147e1ff9dcfaa6fa2eed/inc/admin/options.php#L19-L25

Estimate the effort :white_check_mark:

Effort [XS]

mostafa-hisham avatar Sep 05 '22 05:09 mostafa-hisham

We won't be fixing it, based on Vasilis comment here: https://github.com/wp-media/wp-rocket/pull/5391#issuecomment-1243426262

piotrbak avatar Oct 10 '22 10:10 piotrbak