Support

Account

Home Forums Gutenberg js fires before block is rendered Reply To: js fires before block is rendered

  • I actually had exactly the same issue after creating a slideshow block with slick, as well as all of my other blocks that use javascript.

    The problem was, I copied and pasted the wp_enqueue_script some documentation at some point and I had (notice the lack of a version #):
    wp_enqueue_script( 'slideshow-block-library', get_template_directory_uri() . '/template-parts/block/js/slick.min.js', array('jquery'), true );

    When I should have had:
    wp_enqueue_script( 'slideshow-block-library', get_template_directory_uri() . '/template-parts/block/js/slick.min.js', array('jquery'), '1.0.0', true );

    For more info, see the WordPress Docs here.