Smile-SA / smile-magento-elasticsearch

Magento ElasticSearch Implementation
151 stars 90 forks source link

Uncaught TypeError: Cannot read property 'autocompleteIndex' of undefined #101

Closed Quazz closed 7 years ago

Quazz commented 7 years ago

When hovering over suggested results, every line returns this error in console log.

Uncaught TypeError: Cannot read property 'autocompleteIndex' of undefined

The error seems to originate from scriptaculous controls.js

Clicking on a result results in a similar error and not the expected page load.

I've searched for a while in hopes for a solution, but haven't found one yet, hopefully you can help me better with this problem.

Quazz commented 7 years ago

If I disable Magento html output cache AND use Chrome Developer Console to disable local cache, it works perfectly every time. I have no idea how or why that is, though.

Update: And now sometimes it doesn't?!? Really don't know what to think about this anymore.

Quazz commented 7 years ago

Update on this:

It seems to be directly tied to how quickly results are returned from the search engine. Any significant delay, will cause this error to appear.

Quazz commented 7 years ago

After analyzing the XHR traffic, I noticed two requests per query.

This was causing all the issues. Turns out, there was a second search, using the normal template that was causing the issue.

Removing the autocomplete segment from that template fixed the issue. (it's not necessary for it, and wasn't supposed to work regardless)

So, a lot of hairpulling and sighs for what turned out to be a fairly simple reason.