Uncaught ReferenceError: wp_localize_script_autocomplete is not defined

  • Bodav
    Participant
    3 years ago #27924

    hi,
    i enabled the suggestions option, and in incognito i get this js error:
    https://snipboard.io/Rdzn7q.jpg

    should i exclude this file from cache or any known issue?

    wpsolr
    Keymaster
    3 years ago #27925

    It looks like your HTML code is optimised, and that the WPSOLR javascript variable declaration is deferred, causing the error.

    wpsolr
    Keymaster
    3 years ago #27926

    I’m building a quick fix right now.

    wpsolr
    Keymaster
    3 years ago #27927

    Please replace your current WPSOLR version with this release, and clear your caches: https://www.dropbox.com/s/hqj4ia77jloh3rd/wpsolr-pro-fix-js-when-html-optimised.zip?dl=0

    The release includes the following fixes/improvements:
    – Prevent wp_localize_script_autocomplete javascript error when HTML is optimised

    Bodav
    Participant
    3 years ago #27928

    i excluded this file from deferred but it still is not loading on incognito
    do i need to exclude any other files maybe with it?

    wpsolr
    Keymaster
    3 years ago #27929

    Did you install the fix and cleared your caches?

    Bodav
    Participant
    3 years ago #27930

    wow thanks! that was quick

    Bodav
    Participant
    3 years ago #27931

    i did not see you posted it..installing it right now!

    Bodav
    Participant
    3 years ago #27932

    still got js error, but changed a bit, cleared caches of course.
    https://snipboard.io/styrNW.jpg

    wpsolr
    Keymaster
    3 years ago #27934

    Yes, the problem is the same, but in another part of the script.
    But this time, I cannot fix it.
    What kind of tools do you use to optimize your pages?

    Bodav
    Participant
    3 years ago #27935

    wp-rocket plugin. it does deffer and delay js files
    i’ll try to exclude this file name

    wpsolr
    Keymaster
    3 years ago #27936

    I’ll try on my environment with WP-Rocket, as it might concern (many) other customers.

    wpsolr
    Keymaster
    3 years ago #27937

    I could replicate the issue with WP Rocket deferred js loading, but could not find a quick fix.
    Try to add exclusions on file autocomplete_solr.js

    Added to roadmap: https://trello.com/c/HIO2YKFA/179-fix-issue-with-deferred-js-loading-with-wp-rocket

    Bodav
    Participant
    3 years ago #27939

    added it to all the exclusions..but it depends on Jquery that also needs to be excluded and there im stuck

    Bodav
    Participant
    3 years ago #27940

    ok fixed it for now, with excuding jquery from delay and deffer, just use this string in wp rocket exclude on deffer and delay js:
    /jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js
    screenshot
    https://snipboard.io/Bc3uvl.jpg

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.