• Resolved grex22

    (@grex22)


    After a recent update, I’ve noticed we started getting the below error on every page load.

    TypeError: Cannot read properties of null (reading ‘addEventListener’)
    at window.onload (callout.js:26:60)

    By itself, it’s not a huge deal, but if you try to concat / minify Javascript with something like WP Rocket, this error can cause the rest of the JS in the load path to not load properly.

    The issue on admin/js/callout.js is that this block fails if there’s no element by that ID on the page:

    document.getElementById("toplevel_page_sb-instagram-feed").addEventListener("mouseenter", (event) => {
    if (!document.body.classList.contains('index-php')) {
    positionCalloutContainer()
    }
    });

    document.getElementById("toplevel_page_sb-instagram-feed").addEventListener("mouseleave", (event) => {
    if (!document.body.classList.contains('index-php')) {
    positionCalloutContainer(true)
    }

    });

    I’ve temporarily solved this by putting a conditional around those blocks of:

    if(document.getElementById("toplevel_page_sb-instagram-feed")){
    ...
    }

    This whole thing is odd to me, however, as it seems like this script shouldn’t even be loading on the front-end of the website? This appears to be an admin-side script, no? Did a recent change accidentally make this script load on front-end as well?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Smash Balloon Louis

    (@smashballoonlouis)

    Hi @grex22,

    Thank you for the detailed feedback about this issue! I have shared this with our development team so they can investigate and make any necessary updates to fix this.

    Best regards,
    Louis

    Another temporary solution that can go in your own theme or plugin:

    function handle_scripts() {
    if ( !is_admin() ) {
    wp_dequeue_script( 'callout-js' );
    wp_deregister_script( 'callout-js' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'handle_scripts', 1000 );
    Plugin Support Smash Balloon Louis

    (@smashballoonlouis)

    Hi!

    Sorry about the issue here! We added a feature to the plugin to help our users who have multiple Smash Balloon products get started with setting up their feeds. We apologize for missing these errors. We have released an update to the plugin to fix this. Please let us know if you are still having any trouble after updating to version 6.4.1

    Best regards,
    Louis

    Thread Starter grex22

    (@grex22)

    @smashballoonlouis thanks to you and your team for the speedy response and hotfix!

    Plugin Support Smash Balloon Louis

    (@smashballoonlouis)

    Hi @grex22,

    You’re very welcome and thanks for your understanding!

    Best regards,
    Louis

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.