Skip to content

Commit

Permalink
fix: only initialize components when script is localized
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink committed Feb 27, 2024
1 parent 313a1ff commit b6cd06f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/php/ComponentsJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public function __construct()

];

add_action('init', array($this, 'createComponents'));
add_action('wp_enqueue_scripts', array($this, 'renderComponents'), 50);
}

Expand All @@ -29,6 +28,8 @@ public function __construct()
*/
public function renderComponents() //:void
{
$this->createComponents();

wp_localize_script(
'algolia-index-js-searchpage',
'algoliaSearchComponents',
Expand Down

0 comments on commit b6cd06f

Please sign in to comment.