wpdreams / ajax-search-pro-development

Issues and dev tracking repository for Ajax Search Pro for WordPress plugin
0 stars 0 forks source link

The plugin does not work after updating to version 4.26.13 #143

Closed kroix closed 3 months ago

kroix commented 3 months ago

Describe the bug

The plugin does not work (default WP search also doesn't work) and illustrations are not displayed on the site when the plugin is enabled after updating Ajax Search Pro to version 4.26.13. Only background and banners are displayed from the images. If you disable the plugin, all illustrations are returned.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Plugins -> Installed
  2. Click on Ajax Search Pro —> Activate
  3. See error
  4. Click on Ajax Search Pro —> Deactivate
  5. No error

Expected behavior

Displaying illustrations on the site, as before, the search plugin works.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment checklist

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

BelVaping - Google Chrome Ajax Search Pro off BelVaping - Google Chrome Ajax Search Pro on photo_2024-08-01_19-10-19 Плагины ‹ BelVaping — WordPress - Google Chrome ]

exetico commented 3 months ago

I can confirm the same.

There's a problem around D.trigger.apply(m, [R].concat(l)), in the cache file asp-*.js, which does crash our whole JavaScript bundled file, too.

image

image

This needs to be prioritized.

Could sounds like something related to #133 . For that kind of change, I'd personally recommend a beta-release, before pushing out a release to all users.

After checking the docs, wp-dreams in general, codecanyon, the plugin and more, I've not managed to find a way to downgrade the plugin. That's crazy by itself. Have I missed somthing? I even checked the source-code, but it does nok look like I'm able to query a specific version of ASP to the https://update.wp-dreams.com/ endpoint, just to see how it did go. I'm only able to request a short lived download link, where I can't find any hints on how I could force another version to be served, instead.

ernestmarcinko commented 3 months ago

The files are all right, it's the additional minification by cache plugins. We use a esbuild now, which is a different bundler. I just tested WPRocket and W3TC minifiers, they both fail during minification of the already minified source files.

The issue can be resolved by excluding the files from minify:

asp-(.*).js

or by changin the source to non-minified:

image

There is always a beta test, if you want, you can both join via this link, you are more than welcome.

Nevertheless I'm looking into this to see if I can add programmatical exceptions for already minified sources.

kroix commented 3 months ago

Hi Ernest, Thanks for your tips, but with Ajax Search Pro 4.26.13 & W3 Total Cache: 1) can be resolved by excluding the files from minify: asp-(.*).js 2) changin the source to non-minified (Javascript source not minified)

Ajax Search Pro ‹ BelVaping — WordPress - Google Chrome Минификация  W3 Total Cache ‹ BelVaping — WordPress - Google Chrome

Both don't work.

Completely disabling JavaScript caching minification helped.

Минификация  W3 Total Cache ‹ BelVaping — WordPress - Google Chrome1

exetico commented 3 months ago

Changing to "non minified" version in the panel, still won't play nice with a normal JavaScript bundled file. I'd also like to confirm that I removed the cached ack-*.js files in mh cache dir before testing it.

(Extra feedback 1: Consider flushing the asp file cache, after a user jump from non-minified, to minified, and vice versa.)

Here's the problem, and the result after I use Litespeed cache's Page optimizer, where most scripts are merged into one: image

It's around here, if I disable the bundled JS optimization in my env: image And yes, ofc it works without having it bundled with my other scripts :-).

So something needs to be done, as it's not able to be bundled up anymore, at least with LiteSpeed Cache.

(Extra feedback 2: Also, switching builder/compiler/bundle stack, should at least be a minor version bump, not only a patch bump.)

ernestmarcinko commented 3 months ago

Bundling/Concat seems to work all right on my end, as long as the source is not going through a minify process again - that's where the problems start as the files are already minified. Non-minified is okay-ish, but it's not the solution.

One thing I have noticed is by renaming all minified sources to .min.js from .js seems to resolve all issues. W3TC simply ignores the minify step when noticing the .min in the file name. Whenever they are concatenated at the end should make no difference as they are loaded up in the same order. As long as there is no extra minify step and the file contents are untouched all will be fine.

Excluding the files from the minify step programmatically or manually is the only possible solution here. Let me test other cache plugins to see if .min does the trick. It makes sense.

exetico commented 3 months ago

Did you check the "bundled JS" solution in W3TC, too? (or whatever it's called)

As stated, I did face problems with the non-minified version of asp-*.js, too. I disabled the minified version, cleared out all the cached asp files, cleared the LiteSpeed cache, and tested it (CDN flushed, too, ofc.).

Let me know if you don't have a LiteSpeed instance running. I joined the Slack, btw, but I'm clearly the only person there. With that said, I've previously started a full-stack LiteSpeed instance with WordPress and LiteSpeed Cache in Docker, if that's something you normally do.

ernestmarcinko commented 3 months ago

I'm currently trying Litespeed, that does not care about the .min, it minifies and breaks it immediately. I'm checking if there is a regex or any other way.

exetico commented 3 months ago

I'd really like if it's possible to keep using LiteSpeed Cache the normal way (bundled file, and still minified). But I'm not sure, if it's just a configuration tweak in your new esbuild configuration, or if it's more problematic than that.

I've used esbuild before, but I'm not doing any kind of development for WordPress, related to plugins and stuff like that. With that said, I'm (sort of) used to debugging in the LiteSpeed Cache env.

ernestmarcinko commented 3 months ago

Got a solution for Litespeed in the meantime via litespeed_optimize_js_excludes hook. Unfortunately only full exclusion is possible from the bundle, it can't ignore only the minify step.

I have tried at least a 100 different esbuild configs, but no luck, re-minify always fails. I mean it shouldn't, but the cause should not be a minified input - but javascript minification is a pain on it's own.

ernestmarcinko commented 3 months ago

Okay, Litespeed, WP Rocket, W3TC seem to be resolved. W3TC & WP Rocket can even bundle into one file, Litespeed can't.

Which other plugins should I test? I'm not a big minify user myself so I don't know them very well. Let me know :)

exetico commented 3 months ago

Just for my confirmation; As mentioned, LiteSpeed Cache also broke with the standard version (non-minified) version of the asp script, after it had been minified and combined with the LiteSpeed Cache Page Optimization solution.

That's still a problem :)?

1) Changed to the non-minified version of the asp script 2) Removed every asp script in the cache dir 3) Confirmed that the new asp file (asp-0a562175.js) was not minified 4) Jumped to the Tuning > JS Excludes and removed cache/asp/ 5) Removed the caching I had in LiteSpeed Cache 5) Flushed my CDN Cache 6) Saw the script break again, after LiteSpeed Cache minified it

Is that fixed?

With the old build of .12, I could both bundle the acp script, and minify it with LiteSpeed Cache, even though I used the minified version of the ASP script.

I've personally not used other solutions than Litespeed Cache, WP Rocket and W3TC.

ernestmarcinko commented 3 months ago

Update: Autoptimize, SG Optimizer, WP-Optimize all work with the .min solution.

Just for my confirmation; As mentioned, LiteSpeed Cache also broke with the standard version (non-minified) version of the asp script, after it had been minified and combined with the LiteSpeed Cache Page Optimization solution.

That's still a problem :)?

  1. Changed to the non-minified version of the asp script
  2. Removed every asp script in the cache dir
  3. Confirmed that the new asp file (asp-0a562175.js) was not minified
  4. Jumped to the Tuning > JS Excludes and removed cache/asp/
  5. Removed the caching I had in LiteSpeed Cache
  6. Flushed my CDN Cache
  7. Saw the script break again, after LiteSpeed Cache minified it

Is that fixed?

On my end it's okay - but that highly depends on what's within the whole bundle. If Litespeed minifies after concat (which makes sense), then it's different for every single setup.

ernestmarcinko commented 3 months ago

Update: Autoptimize, SG Optimizer, WP-Optimize all work with the .min solution.

Just for my confirmation; As mentioned, LiteSpeed Cache also broke with the standard version (non-minified) version of the asp script, after it had been minified and combined with the LiteSpeed Cache Page Optimization solution. That's still a problem :)?

  1. Changed to the non-minified version of the asp script
  2. Removed every asp script in the cache dir
  3. Confirmed that the new asp file (asp-0a562175.js) was not minified
  4. Jumped to the Tuning > JS Excludes and removed cache/asp/
  5. Removed the caching I had in LiteSpeed Cache
  6. Flushed my CDN Cache
  7. Saw the script break again, after LiteSpeed Cache minified it

Is that fixed?

On my end it's okay - but that highly depends on what's within the whole bundle. If Litespeed minifies after concat (which makes sense), then it's different for every single setup.

Correction, it does not work, I didn't delete the correct folder. I'm afraid that will not give in :(

exetico commented 3 months ago

That's my point, and that have not been a problem on previous versions. I guess I just have to exclude the asp script at this point, but I'm not that happy with the solution.

I've not checked if LiteSpeed Cache are first bundling up scripts, and hereafter, minifying them.

It sounds like I need to bring up a staging env., just to see what's causing the problem. With that said; I've linked to pastebin in one of my emails, but, I understand that it doesn't help much, now that its just a esbuild configuration (or solution) thing; nothing in your source code.

exetico commented 3 months ago

Correction, it does not work, I didn't delete the correct folder. I'm afraid that will not give in :(

If so, we need to find out what's going on. I've used the LiteSpeed Cache Slack channel before, so, I'll give them a hint, too. However, I'd suggest you try and ask them, too. You know, as the main developer 😄.

Update: Posted here 👉 https://golitespeed.slack.com/archives/C3RJHNBTQ/p1722608802507639

ernestmarcinko commented 3 months ago

Okays, thanks! The bundle is okay for sure, I was looking at the errors, it was basically missing parts of code (few parenthesis as far as I was able to decode).

The best possible approach in my optinion is to programmatically exclude, as the issue is not directly with this plugin, but with the minify itself, which unfortuantely does happen from time to time. If there is (or going to be) a hook to simply exclude the files from minify but not from concat/bundle into one file, I'm more than happy to code that in.

exetico commented 3 months ago

I'm still wondering if all esbuilds are facing the same issues with LiteSpeed after minification and bundling, or if this is specific to a package in your bundle. I didn't spend time on looking into that part. Did you check that, yourself? I mean, if it's your source-code, or another npm package.

ernestmarcinko commented 3 months ago

WAIT A SECOND

Adding the .min actually fixes Litespeed Cache! That's why it was working!!! I thought it was because of non-minified, but it's because of the minified source! YAY

image

ernestmarcinko commented 3 months ago

@exetico I have sent you an invite to beta repo, I will try to push an RC tomorrow.

@kroix do you also want an invite to beta test?

kroix commented 3 months ago

@ernestmarcinko No, thanks. I am very weak in development and debugging (I don't know how to do it at all), and I am not ready to conduct experiments on a working site. It is too important for me) I am waiting for the bug in the plugin to be fixed so that I can use the site in the previous configuration. If this does not work, the solution with disabling JavaScript minification will suit me. At least some solution. Should I close this thread or mark something? This is my first and only post on GitHub.

ernestmarcinko commented 3 months ago

@ernestmarcinko No, thanks. I am very weak in development and debugging (I don't know how to do it at all), and I am not ready to conduct experiments on a working site. It is too important for me) I am waiting for the bug in the plugin to be fixed so that I can use the site in the previous configuration. If this does not work, the solution with disabling JavaScript minification will suit me. At least some solution. Should I close this thread or mark something? This is my first and only post on GitHub.

No problem :) It's most likely to be fixed within the first half of next week. I already seem to have a working solution + a few known bugs have to be fixed. Tomorrow I will post a beta release, then if this issue is fixed I will release as soon as possible.

exetico commented 3 months ago

@ernestmarcinko Interesting. I'll give it a go once ready. Feel free to tag me in the merge of the PR, if that's how you're working with GitHub. I'll accept the invite soon.

But... I'm a bit confused, after receiving inputs from the LiteSpeed Cache team: https://golitespeed.slack.com/archives/C3RJHNBTQ/p1722614413864349?thread_ts=1722608802.507639&cid=C3RJHNBTQ

They state that adding "min" shouldn't change a thing. Are you sure, that you actually did things, like you told in the previous post? 😁 Cached ASP and caching from LTC are interesting things to play with in combination, and can outplay even the best devs, from time to time 😉.

With that said; I only use ASP on a single prod-site, where it broke things today. Testing a beta release would only be possible, if you can confirm that no other risks should be expected.

ernestmarcinko commented 3 months ago

I merged a PR related to this, I will post a beta release on the beta repository in a couple of hours to test.

ernestmarcinko commented 3 months ago

Are you sure, that you actually did things, like you told in the previous post? 😁 Cached ASP and caching from LTC are interesting things to play with in combination, and can outplay even the best devs, from time to time 😉.

It's 100%, I just tried again. I think they may have forgotten about this feature, or there is a built in check within the minifier to check the filenames. Either way, it's a good thing, it's how it supposed to be. See tests below.

Test 1 - with .min.js as filename

Litespeed minify/combine disabled:

image

Litespeed enabled: image

Test 2 - withOUT .min.js as filename (as it is now)

Litespeed disabled:

image

Litespeed enabled:

image

This is simply great, you will have a chance to test it in a few hours :)

ernestmarcinko commented 3 months ago

Beta 4.26.14 is ready to test here.

exetico commented 3 months ago

The new minified version works with my setup, too, also with "JS Combine". I've submitted another issue, not related to this, I noticed while testing the beta-release (the issues with Rocket Loader are not related to this, though).

kroix commented 3 months ago

@ernestmarcinko After the update everything works fine. Minification is enabled (minify and combine). Thanks for the great plugin and for solving the problem!