Skip to content

Commit

Permalink
Revert "Avoid not needed serialization"
Browse files Browse the repository at this point in the history
This reverts commit 78daef1185373c7153f060f580427d0331caa57e.
  • Loading branch information
cbravobernal committed Feb 2, 2024
1 parent 39d79ad commit 4dede2f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ function wp_interactivity_process_directives_of_interactive_blocks( $parsed_bloc
( isset( $block_type->supports['interactivity']['interactive'] ) && true === $block_type->supports['interactivity']['interactive'] ) )
) {
// Annotates the root interactive block for processing.
$root_interactive_block = array( $block_name, $parsed_block );
$root_interactive_block = array( $block_name, md5( serialize( $parsed_block ) ) );

/*
* Adds a filter to process the root interactive block once it has
* finished rendering.
*/
$process_interactive_blocks = static function ( $content, $parsed_block ) use ( &$root_interactive_block, &$process_interactive_blocks ) {
// Checks whether the current block is the root interactive block.
list( $root_block_name, $root_parsed_block ) = $root_interactive_block;
if ( $root_block_name === $parsed_block['blockName'] && $parsed_block === $root_parsed_block ) {
list($root_block_name, $root_block_md5) = $root_interactive_block;
if ( $root_block_name === $parsed_block['blockName'] && md5( serialize( $parsed_block ) ) === $root_block_md5 ) {
// The root interactive blocks has finished rendering, process it.
$content = wp_interactivity_process_directives( $content );
// Removes the filter and reset the root interactive block.
Expand Down

0 comments on commit 4dede2f

Please sign in to comment.