wpdreams / ajax-search-pro-development

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

ASP does not work with Cloudflare Rocket Loaders - No triggers works (i.e. key input, pressing search, pressing enter) #148

Closed exetico closed 4 weeks ago

exetico commented 2 months ago

Describe the bug

I normally use the "Rocket Loader" function from Cloudflare. But it breaks the plugin.

The search-bar are rendered, and the "asp" script are loaded to. However, nothing happens if I press the search bar, nor pressing the search icon.

image

The same settings works just fine without Rocket Loader.

image

I do not use the Initialize search instances only when they get visible on the viewport? option.

To Reproduce

Steps to reproduce the behavior:

  1. Enable ASP
  2. Enable Rocket Loader in Cloudflare
  3. See that no search field trigger works

I've tried to add breakpoints, but I can't get ASP to trigger. I've seen jQuery picking up events, but that's it.

Expected behavior

I'd love to have ASP support back. It have been working before, maybe before 4.26.13, but as I have no option to use a older version of the plugin, I'm unable to test it.

Feel free to drop a email with a older version and a extra license code.

Screenshots

No screenshots needed. It's just a empty search field.

image

No events are picked up. I guess ASP are not initiated correctly, or not initiated at all.

I'm not sure if there's any global variables or hooks I'm able to use, to provide more useful information for you. I've not looked through the source-code.

Environment checklist

Desktop (please complete the following information):

Additional context

I know this is a 3rd-party specific product, but I really enjoy the Rocket Loader solution. I'm unable to tell, if this has been broken for a longer period of time, of just a few releases.

Also, we use "word auto-complete" suggestions, and that does not work, either.

ernestmarcinko commented 2 months ago

This is a known issue for the longest time unfortunately. I don't recall the exact source, but I believe it was one of the 3rd party scripts we bundle, that simply can't load up and it breaks everything.

Either way, let's keep it open, I can't test this right now, but will mark it for the next minor milestone. Solving this would be a big deal.

exetico commented 2 months ago

Interesting. I can say that we've used Rocket Loader for more than a year, without user complaints. Is it possible, that it worked for a period of time, and became a problem, once again?

Once trying and scroll through my internal toughts (🙈), I think a small bell rings regarding a conflict with ASP. But I'm sure I tested it, before enabling Rocket Loader. Yesterday I debugged the "min" problem, so I didn't note down the last time I changed the Rocket Loader-option (it's rendered in the Cloudflare Front-end). But appx one year sounds realistic.

I would really appreciate it.

I'm open for testing, and I'll also be able to provide a staging server, if you don't have a setup with Rocket Loader as a option.

ernestmarcinko commented 2 months ago

Could be, but there are only a very few support tickets related to this. Rocket loader usually causes issues with many popular plugins (as far as I experienced) so many will turn it off before it even before ajax search pro is installed.

This is another feature that highly depends on how any previous scripts were executed. In many cases the error occurs before ASP is even loaded and it masks the issue as if ASP is the cause, whereas the script execution stopped with a fatal error. It's the same thing with conatenated bundles and minifiers.

Either way, I will definitely play around with this. Thank you for your offer, I have a server to replicate this. I marked this for the 4.26.15 milestone. Let's get 4.26.14 out first. Let me know if you found any suspicious bugs compared to the other version. I'm testing as we speak, if all goes well I will push it live in a couple of hours.

ernestmarcinko commented 4 weeks ago

Found the culprit of the issue. Apparently Cloudflare fiddles with the document content loaded event, and so the init method is never fired. The solution is to add another event listener to the readystatechange document event as well. I'm testing this as we speak and it seems to be working.

exetico commented 2 weeks ago

Thank you for the update :-)!