Skip to content

Commit

Permalink
Fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Oct 18, 2023
1 parent 74be58a commit f341fc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ public function get_context() {
* @return void
*/
public function set_context( $context ) {
if ( $context ) {
array_push( $this->stack, array_replace_recursive( $this->get_context(), $context ) );
}
array_push(
$this->stack,
array_replace_recursive( $this->get_context(), $context )
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/experimental/interactivity-api/directives/wp-context.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function gutenberg_interactivity_process_wp_context( $tags, $context ) {

$new_context = json_decode( $value, true );
if ( null === $new_context ) {
// Invalid JSON defined in the directive.
return;
// If the JSON is not valid, we still add an empty array to the stack.
$new_context = array();
}

$context->set_context( $new_context );
Expand Down

0 comments on commit f341fc1

Please sign in to comment.