Skip to content

Commit

Permalink
optimized load_frontend_scripts_conditionally by removing repeated ca…
Browse files Browse the repository at this point in the history
…lls to substr
  • Loading branch information
[email protected] committed Apr 26, 2024
1 parent 46b0d0d commit aea11fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ public function load_frontend_scripts_conditionally( $block_content, $block ) {
}

// Enqueue the block script once.
$stackable_block = substr( $block['blockName'], 10 );
if ( ! isset( $this->scripts_loaded[ $stackable_block ] ) ) {
if ( ! isset( $this->scripts_loaded[ $block['blockName'] ] ) ) {
$stackable_block = substr( $block['blockName'], 10 );
do_action( 'stackable/' . $stackable_block . '/enqueue_scripts' );
$this->scripts_loaded[ $stackable_block ] = true;
$this->scripts_loaded[ $block['blockName'] ] = true;
}

// Check whether the current block needs to enqueue some scripts.
Expand Down

0 comments on commit aea11fa

Please sign in to comment.