Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactivity API: Render the root interactive blocks #57729

Merged
merged 9 commits into from
Jan 15, 2024

Conversation

cbravobernal
Copy link
Contributor

@cbravobernal cbravobernal commented Jan 10, 2024

What?

Identify and render/process only the root interactive blocks.

Why?

We tested a skipping not interactive blocks for processing the HTML, but we found it too complex. The HTML API seems perfomant enough to try an approach of a single-pass processing the interactive islands of the page.

To be able to acommodate it, we need to work on a couple of steps:

  • Identify the root interactive blocks and their children (islands).
  • Skip interactive blocks that are children of another interactive (And will be processed in the final render step)
  • Refactor, clean and move to one process_interactivity function.

Screenshot 2024-01-10 at 17 26 31

How?

This PR covers only the first two steps. Identifying and skipping interactive children.

@cbravobernal cbravobernal self-assigned this Jan 10, 2024
@cbravobernal cbravobernal added [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement. labels Jan 10, 2024
Copy link

github-actions bot commented Jan 10, 2024

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/experimental/interactivity-api/class-wp-directive-processor.php
❔ lib/experimental/interactivity-api/directive-processing.php
❔ phpunit/experimental/interactivity-api/directive-processing-test.php

@cbravobernal cbravobernal marked this pull request as ready for review January 11, 2024 15:46
@cbravobernal cbravobernal changed the title Interactivity API: Render the root interactive blocks (WIP) Interactivity API: Render the root interactive blocks Jan 11, 2024
Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@luisherranz luisherranz merged commit 4c31959 into trunk Jan 15, 2024
60 checks passed
@luisherranz luisherranz deleted the update/interactivity-sdp-render-interactive-roots branch January 15, 2024 18:09
@github-actions github-actions bot added this to the Gutenberg 17.6 milestone Jan 15, 2024
@youknowriad
Copy link
Contributor

Has this been backported to Core already?

@luisherranz luisherranz added the Backported to WP Core Pull request that has been successfully merged into WP Core label Feb 8, 2024
@luisherranz
Copy link
Member

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants