Skip to content

Commit

Permalink
Use expected core filter name and element ID
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed May 14, 2024
1 parent f9f1610 commit 77a6b8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function register_script_modules() {
* @since 6.5.0
*/
public function add_hooks() {
add_filter( 'gb_scriptmoduledata_@wordpress/interactivity', array( $this, 'print_client_interactivity_data' ) );
add_filter( 'scriptmoduledata_@wordpress/interactivity', array( $this, 'print_client_interactivity_data' ) );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/experimental/script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function gutenberg_print_script_module_data(): void {
}

foreach ( array_keys( $modules ) as $module_id ) {
$data = apply_filters( 'gb_scriptmoduledata_' . $module_id, array() );
$data = apply_filters( 'scriptmoduledata_' . $module_id, array() );
if ( ! empty( $data ) ) {
/*
* This data will be printed as JSON inside a script tag like this:
Expand Down Expand Up @@ -264,7 +264,7 @@ function gutenberg_print_script_module_data(): void {
wp_json_encode( $data, $json_encode_flags ),
array(
'type' => 'application/json',
'id' => 'gb-scriptmodule-data_' . $module_id,
'id' => 'wp-scriptmodule-data_' . $module_id,
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/interactivity/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export function store(

export const parseInitialData = ( dom = document ) => {
const jsonDataScriptTag = dom.getElementById(
'gb-scriptmodule-data_@wordpress/interactivity'
'wp-scriptmodule-data_@wordpress/interactivity'
);
if ( jsonDataScriptTag?.textContent ) {
try {
Expand Down

0 comments on commit 77a6b8e

Please sign in to comment.