Latest update not working

New home Forums Pro Add-on Installing and Updating Latest update not working

This topic contains 17 replies, has 3 voices, and was last updated by  Dylan 3 years ago.

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #22554

    dfhemenway
    Member

    Hi,

    Yes, it looks like it is working fine now. Many thanks. The Algolia search plugin has been causing other problems as well, so I may end-up not using it in the long-term. I’m sorry it caused this difficulty with your plug-in.

    #22560

    dfhemenway
    Member

    Hello again,

    Whatever changes you made to fix the conflict between Algolia and your plug-in on my site also fixed a different problem that Algolia was causing — a conflict with the display of the menu on the home page when viewed in mobile mode (the menu didn’t show up on the home page when viewed on my iPhone, but did appear properly on all the subsidiary pages; if I disabled Algolia, then the menu worked fine). They had been looking into that for me. Now, since it is working ok, they asked me to check back with you to see if you could provide more details about the JavaScript conflicts and the runtime checks, in order to help them troubleshoot their plug-in.

    Don

    #22565

    Dylan
    Moderator

    Hi Don,

    Only a pleasure, so glad to hear this helped!

    I am happy to provide you with the checks/changes I made.

    As mentioned earlier there was a ‘hits’ is undefined error showing up in the console. This was due to the function they are trying to call (within JavaScript) not being available/ready.

    I resolved this by wrapping the following:

    sources.push({
       //Relevant initialization code here
    });

    In a check as seen here:

    
    if(typeof autocomplete === 'undefined' &&  typeof autocomplete.sources !== 'undefined' && typeof autocomplete.sources.hits !== 'undefined'){
      sources.push({
         //Relevant initialization code here
      });
    }

    This prevents the code from running in the event that the function is not defined. This is good practice within JavaScript to prevent conflicts such as the one we had seen earlier.

    Additionally, to prevent any further conflict (in the event that ‘hits’ is undefined) I also wrapped the segment of code seen just below the above mentioned code:

    jQuery("input[name='s']:not('.no-autocomplete')").each(function(i) {
       //Relevant runtime code here
    });

    With a simple check as seen below:

    if(typeof autocomplete === 'function'){
      jQuery("input[name='s']:not('.no-autocomplete')").each(function(i) {
        //Relevant runtime code here
      });
    }

    Although this will prevent the code from running if autocomplete is not a function, this should still be done to prevent any conflicts.

    The plugin developer needs to simply ensure that the variable/functions are defined prior to them being used and the functionality will continue as expected.

    I hope this helps?

Viewing 3 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic.