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

Enable mobile cache button is not working in some cases #6643

Closed
wordpressfan opened this issue May 20, 2024 · 7 comments · Fixed by #6645
Closed

Enable mobile cache button is not working in some cases #6643

wordpressfan opened this issue May 20, 2024 · 7 comments · Fixed by #6645
Assignees
Labels
module: user interface needs: grooming priority: medium Issues which are important, but no one will go out of business. severity: major Feature is not working as expected and no work around available type: bug Indicates an unexpected problem or unintended behavior
Milestone

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

In this PR:
https://github.com/wp-media/wp-rocket/pull/6600/files#diff-808154db979cdc470bb9d67f22f47c3b27529476df03f52d1f3b9b39ab7dddd0

We removed part of the JS script from the minified version of wpr-admin script, exactly here:

image

It's exactly this part:

/**
* Enable mobile cache option.
*/
$('#wpr_enable_mobile_cache').on('click', function(e) {
e.preventDefault();
$('#wpr_enable_mobile_cache').addClass('wpr-isLoading');
$.post(
ajaxurl,
{
action: 'rocket_enable_mobile_cache',
_ajax_nonce: rocket_ajax_data.nonce
},
function(response) {
if ( response.success ) {
// Hide Mobile cache enable button on success.
$('#wpr_enable_mobile_cache').hide();
$('#wpr_mobile_cache_default').hide();
$('#wpr_mobile_cache_response').show();
$('#wpr_enable_mobile_cache').removeClass('wpr-isLoading');
// Set values of mobile cache and separate cache files for mobiles option to 1.
$('#cache_mobile').val(1);
$('#do_caching_mobile_files').val(1);
}
}
);
});

but it still there in the not minified version of the script here:

/**
* Enable mobile cache option.
*/
$('#wpr_enable_mobile_cache').on('click', function (e) {
e.preventDefault();
$('#wpr_enable_mobile_cache').addClass('wpr-isLoading');
$.post(ajaxurl, {
action: 'rocket_enable_mobile_cache',
_ajax_nonce: rocket_ajax_data.nonce
}, function (response) {
if (response.success) {
// Hide Mobile cache enable button on success.
$('#wpr_enable_mobile_cache').hide();
$('#wpr_mobile_cache_default').hide();
$('#wpr_mobile_cache_response').show();
$('#wpr_enable_mobile_cache').removeClass('wpr-isLoading'); // Set values of mobile cache and separate cache files for mobiles option to 1.
$('#cache_mobile').val(1);
$('#do_caching_mobile_files').val(1);
}
});
});

This makes the button of enabling the mobile cache is not working by default and works only if we changed the value of the constant SCRIPT_DEBUG to be true.

To Reproduce
Steps to reproduce the behavior:

  1. Open any WPR version lower than 3.16 and disable mobile cache.
  2. Update to 3.16 and visit tools page in our WPR settings page.
  3. Make sure that the constant SCRIPT_DEBUG is not added to wp-config.php file or set as false
  4. Click on the button to enable mobile cache and notice the network tab
  5. No request will be sent to enable that option.
  6. Change the SCRIPT_DEBUG constant's value to be true and try again.
  7. You should see the request sent in network tab and once refreshed, you will not see that button again.

Screenshots

mobile-cache-issue-2024-05-17_14.47.00.mp4

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

@piotrbak piotrbak added this to the 3.16.1 milestone May 20, 2024
@piotrbak piotrbak added type: bug Indicates an unexpected problem or unintended behavior priority: medium Issues which are important, but no one will go out of business. needs: grooming severity: major Feature is not working as expected and no work around available module: user interface labels May 20, 2024
@wordpressfan
Copy link
Contributor Author

Here we just need to rebuild the wpr-admin.min.js again using gulp bundleJsWithoutWatch

@Tatilomelino
Copy link

Hi, I'm having this same problem. Watch the video you posted here to follow the instructions, but I don't know how to open the screen you use in wp-config.php (see the attached screen). Could you please explain it to me?
Thank you very much in advance!
Screen Shot 2024-05-23 at 15 41 40

@Mai-Saad Mai-Saad self-assigned this May 24, 2024
@gpapazac
Copy link

Im opening the wp_config file and there is no SCRIPT_DEBUG line. i also updated the code you changed in assets/js/wpr-admin.min.js and assets/js/wpr-admin.js.min.map and nothing happened. The button is still there. a little help would be aprecciated

@simoclicks
Copy link

It works Thank you

@omgwhatcanido
Copy link

3.16 WP Rocket version, no SCRIPT_DEBUG line, and the mobile cache button still does not work, still can't create mobile cache. I feel upset.

@clmnsm
Copy link

clmnsm commented Jun 25, 2024

The button still does not work, even when adding the SCRIPT_DEBUG setting.

Is there a fix that doesn't require downgrading?

@hasanaras8
Copy link

Weird but I can not downgrade and also see no debug code I am just stuck with plug in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: user interface needs: grooming priority: medium Issues which are important, but no one will go out of business. severity: major Feature is not working as expected and no work around available type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants