-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Server Directive Processor for data-wp-each
#58498
Interactivity API: Server Directive Processor for data-wp-each
#58498
Conversation
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/compat/wordpress-6.5/compat.php ❔ lib/experimental/interactivity-api.php ❔ phpunit/interactivity-api/class-wp-interactivity-api-wp-each-test.php ❔ lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api-directives-processor.php ❔ lib/compat/wordpress-6.5/interactivity-api/class-wp-interactivity-api.php ❔ lib/load.php ❔ phpunit/interactivity-api/class-wp-interactivity-api-directives-processor-test.php ❔ phpunit/interactivity-api/class-wp-interactivity-api-test.php ❔ phpunit/interactivity-api/class-wp-interactivity-api-wp-text-test.php |
Flaky tests detected in 4a62bb6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7725949372
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code and tests look great. 👏
PS: I've left some nitpicky suggestions.
phpunit/interactivity-api/class-wp-interactivity-api-directives-processor-test.php
Outdated
Show resolved
Hide resolved
phpunit/interactivity-api/class-wp-interactivity-api-directives-processor-test.php
Show resolved
Hide resolved
phpunit/interactivity-api/class-wp-interactivity-api-wp-each-test.php
Outdated
Show resolved
Hide resolved
Thanks David! Feedback addressed. |
Size Change: +44 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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 SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Let's port this to core and continue working there: |
Tracking Issue: #56803
What?
This PR adds an additional server directive processor to process the
data-wp-each
directive, introduced in:wp-each
directive #57859Why?
Because all the directives that modify the markup should be processed in the server to avoid layout shifts.
How?
By introducing a new method to append content after the closing tag of balanced tags (or after a void tag) and refactoring the
process_directive
method to be used internally with the inner content of thetemplate
that contains thedata-wp-each
directive.It also makes the
next_balanced_tag_closer_tag
public (but with@access private
) to be able to jump from top-level nodes and add the correspondingdata-wp-each-child
directives, which are required during the frontend hydration.This PR also includes a
compat
version of the fallback of the native PHP8array_is_list
function which is going to be introduced in WP 6.5.Testing Instructions
data-wp-each
directive and pass a reference to an array.template
tag are properly rendered.