Skip to content

Support unique IDs in iAPI directives processing#10284

Closed
SantosGuillamot wants to merge 36 commits intoWordPress:trunkfrom
SantosGuillamot:add/support-unique-ids-in-iapi-directives
Closed

Support unique IDs in iAPI directives processing#10284
SantosGuillamot wants to merge 36 commits intoWordPress:trunkfrom
SantosGuillamot:add/support-unique-ids-in-iapi-directives

Conversation

@SantosGuillamot
Copy link
Copy Markdown

@SantosGuillamot SantosGuillamot commented Oct 15, 2025

This PR adds the server-side logic to support unique IDs in the Interactivity API directives. The server should match what the client is doing. See: WordPress/gutenberg#72161. This way, the correct HTML will come directly from the server, and it will avoid layout shifts.

Additionally, it includes a small refactoring to how the directives are processed to follow similar patterns to the client code, and it includes a bunch of tests to ensure everything works as expected.

Trac ticket: https://core.trac.wordpress.org/ticket/64106


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@SantosGuillamot SantosGuillamot changed the title Add/support unique ids in iapi directives WIP: Support unique IDs in iAPI directives processing Oct 15, 2025
@SantosGuillamot SantosGuillamot changed the title WIP: Support unique IDs in iAPI directives processing Support unique IDs in iAPI directives processing Oct 16, 2025
Copy link
Copy Markdown

@DAreRodz DAreRodz left a comment

Choose a reason for hiding this comment

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

I just reviewed this draft, and everything looks great. 😄

Some things could be polished; please check the comments below.

Ah, once you have the Trac ticket created, don't forget to update the ticket number in the test functions!

$context = end( $this->context_stack );
private function evaluate( $entry ) {
$context = end( $this->context_stack );
['namespace' => $ns, 'value' => $path] = $entry;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice. Just confirmed that associative array destructuring is supported since PHP 7.1, and WordPress 6.9 won't support PHP versions older than 7.2. 😄

@SantosGuillamot SantosGuillamot marked this pull request as ready for review October 16, 2025 15:20
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 16, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props santosguillamot, darerodz, luisherranz.

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

@SantosGuillamot
Copy link
Copy Markdown
Author

I've addressed the requested changes, and I added the ticket. Let me know if I should change something else.

SantosGuillamot and others added 2 commits October 16, 2025 17:37
Co-authored-by: David Arenas <darensr@gmail.com>
Copy link
Copy Markdown

@DAreRodz DAreRodz left a comment

Choose a reason for hiding this comment

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

I'm pre-approving this PR.

There's something I would like to change, but I don't have permission to work on this branch. Maybe @luisherranz can make this change. It's not a significant change, I think, and we could fix it in a subsequent PR before the final release.

Copy link
Copy Markdown
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.

Awesome work! 🎉

@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@github-actions
Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61020
GitHub commit: 08e459d

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Oct 21, 2025
@luisherranz
Copy link
Copy Markdown
Member

Committed in 08e459d (r61020).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants