Skip to content

Conversation

@westonruter
Copy link
Member

@westonruter westonruter commented Oct 17, 2025

This is a follow-up to #72340 which removes the new introduction of the new wp_script_module_attributes filter in favor of reusing the existing wp_script_attributes filter. Discussed in WordPress/wordpress-develop#10324 (comment)

See #70873

@westonruter westonruter added [Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity Router /packages/interactivity-router [Type] Enhancement A suggestion for improvement. labels Oct 17, 2025
@westonruter westonruter marked this pull request as ready for review October 17, 2025 16:59
@github-actions
Copy link

github-actions bot commented Oct 17, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: luisherranz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this file can actually be deleted entirely now?

@github-actions
Copy link

github-actions bot commented Oct 17, 2025

Flaky tests detected in e519c02.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18610136860
📝 Reported issues:

@westonruter westonruter added this to the Gutenberg 21.9 milestone Oct 17, 2025
@luisherranz
Copy link
Member

luisherranz commented Oct 20, 2025

Thanks, Weston.

@samueljseay and I have been looking at this. We still need to iron out some details, but we believe that this shows the changes we'd need in Gutenberg to maintain backward compatibility with versions prior to WordPress 6.9. If you agree, we can take over and ask you for a review once it's ready.

EDIT: We will also take care of opening the PR in WordPress Core.

}
if ( $is_fully_interactive || ( $is_supports_interactive && $is_supports_client_navigation ) ) {
foreach ( $block_type->view_script_module_ids as $script_module_id ) {
gutenberg_interactive_script_modules_registry( $script_module_id );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is adding the script to the static array inside of gutenberg_interactive_script_modules_registry(). That works, although it seems a bit unconventional.

* Access the shared static variable for interactive script modules.
*
* @param string|null $script_module_id The script module ID to register, or null to get the list.
* @return array<string, true> Associative array of script module ID => true.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to make this abundantly clear that this "script module ID" is the ID for the SCRIPT[type=module] tag, not the registered "Script Module". Both are being used in this function, which may be confusing.


// Gets private methods via reflection.
$get_marked_for_enqueue = $reflection->getMethod( 'get_marked_for_enqueue' );
$get_marked_for_enqueue->setAccessible( true );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: this is causing a PHP 8.5 deprecation warning:

Deprecated: Method ReflectionMethod::setAccessible() is deprecated since 8.5, as it has no effect in /var/www/src/wp-content/plugins/gutenberg/lib/compat/wordpress-6.9/script-modules.php on line 53

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that file removed in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'm just saying this adds to the importance of getting this merged.

@samueljseay
Copy link
Contributor

samueljseay commented Oct 21, 2025

Just noting that I've migrated @westonruter 's changes from this branch in a new PR here: #72489

This can be closed.

@luisherranz
Copy link
Member

Closing as superseded by #72489.

Thanks Weston!

@priethor priethor removed this from the Gutenberg 21.9 milestone Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity Router /packages/interactivity-router [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants