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

Fix WP Search with Algolia seach feature

Open DahmaniAdame opened this issue 3 years ago • 7 comments

https://secure.helpscout.net/conversation/1736063475/315781/

DahmaniAdame avatar Jan 12 '22 11:01 DahmaniAdame

The issue was reproducible while jQuery is excluded in UI. However, on the branch (while excluding jQuery), the original error was fixed but another error was there in the console. Screenshot from 2022-01-13 13-08-29

@DahmaniAdame can you please check if anything else needs to be excluded.

Mai-Saad avatar Jan 13 '22 11:01 Mai-Saad

@Mai-Saad the issue is fixed adding the underscore.min.js and the wp-util.min.js libraries to the exclusions:

/jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js
/wp-includes/js/underscore.min.js
/wp-includes/js/wp-util.min.js
/wp-search-with-algolia/js/algoliasearch/dist/algoliasearch-lite.umd.js
/wp-search-with-algolia/js/autocomplete-noconflict.js
/wp-search-with-algolia/js/autocomplete.js/dist/autocomplete.min.js
var algolia

Can you check if it's working properly now on https://new.rocketlabsqa.ovh/youtube-regular-2/?

DahmaniAdame avatar Jan 15 '22 09:01 DahmaniAdame

@DahmaniAdame Please notice that (on branch): 1- Exclusions mentioned here https://github.com/wp-media/wp-rocket/pull/4645#issuecomment-1013653974 are working fine with delay js 2- We have a jQuery error when combine js is enabled (same on the trunk) I think the same exclusions are needed for Combine JS (not sure if we will add this here or on different PR). what do you think? Screenshot from 2022-01-17 10-38-31

Note: For the Delay JS problem, it wasn't reproducible on trunk except if we excluded jQuery so do we need global exclusions here not site-based? (just confirming that)

Mai-Saad avatar Jan 17 '22 08:01 Mai-Saad

@Mai-Saad Do we have any problem when nothing is excluded from Delay JS? If the problem happens only when jQuery is excluded, I don't think we need a global exclusion for that.

piotrbak avatar Jan 17 '22 12:01 piotrbak

@piotrbak on the test site using trunk, the problem with Delay JS is there only when we exclude jQuery (if we auto exclude jQuery with any other plugin/theme then maybe that was causing the problem at the client site) While the error with Combine JS is there without adding any exclusions.

Mai-Saad avatar Jan 17 '22 14:01 Mai-Saad

@Mai-Saad @DahmaniAdame I'm not able to reproduce the problem when no exclusions are there. Here's what I'm experiencing:

Delay JS

  1. No exclusions are being made, no issue
  2. /jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js exclusion, no issue
  3. jquery exclusion, there's a problem mentioned by Adame (this exclusion doesn't seem to be correct though)

Combine JS

  1. There's a problem, as Algolia inline script is automatically excluded because of dynamic inline exclusions. However, it's dependent on the jQuery, so it should be placed below the combined file. The solution is to move this exclusion to this array.

@DahmaniAdame Could you confirm the Delay JS part on the customer's website?

piotrbak avatar Jan 17 '22 15:01 piotrbak

Removing it from the 3.11.2 milestone. We still need an exploratory and confirmation here.

piotrbak avatar May 04 '22 14:05 piotrbak