Support unique IDs in iAPI directives processing#10284
Support unique IDs in iAPI directives processing#10284SantosGuillamot wants to merge 36 commits intoWordPress:trunkfrom
Conversation
DAreRodz
left a comment
There was a problem hiding this comment.
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!
src/wp-includes/interactivity-api/class-wp-interactivity-api.php
Outdated
Show resolved
Hide resolved
| $context = end( $this->context_stack ); | ||
| private function evaluate( $entry ) { | ||
| $context = end( $this->context_stack ); | ||
| ['namespace' => $ns, 'value' => $path] = $entry; |
There was a problem hiding this comment.
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. 😄
src/wp-includes/interactivity-api/class-wp-interactivity-api.php
Outdated
Show resolved
Hide resolved
src/wp-includes/interactivity-api/class-wp-interactivity-api.php
Outdated
Show resolved
Hide resolved
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
I've addressed the requested changes, and I added the ticket. Let me know if I should change something else. |
Co-authored-by: David Arenas <darensr@gmail.com>
DAreRodz
left a comment
There was a problem hiding this comment.
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.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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.