-
Notifications
You must be signed in to change notification settings - Fork 4.6k
iAPI Router: Update router regions inside elements with data-wp-interactive
#71635
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
base: trunk
Are you sure you want to change the base?
Conversation
I'm trying to replicate the current supported behavior for router regions with the new implementation, but I'm encountering issues when multiple regions use It's as if Preact gets confused and reverses the order in which these regions were initially rendered, changing, for example, the context ( It's been hard to debug so far. I'll keep investigating. |
Size Change: +432 B (+0.02%) Total Size: 1.95 MB
ℹ️ View Unchanged
|
Flaky tests detected in 19ca66d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17867991827
|
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 If 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. |
@luisherranz, I think this is ready for review. With the current implementation, elements with the I.e., this router region is updated: <div data-wp-interactive="example-1">
<div
data-wp-interactive="example-1/router-region"
data-wp-router-region="example-1/router-region"
>
<!-- content -->
</div>
</div> This one won't be updated: <div data-wp-interactive="example-1">
<div data-wp-router-region="example-1/router-region">
<!-- content -->
</div>
</div> It's a problem that we can easily solve, just by modifying the |
What?
Closes #71519
Adds support for elements with the
data-wp-router-region
directive inside other elements withdata-wp-interactive
.Why?
Currently, only elements with both
data-wp-router-region
anddata-wp-interactive
attributes, excluding those within an element withdata-wp-interactive
, are considered regions and updated.This PR aims to handle any elements with
data-wp-router-region
inside an interactive element.See #71519 for more info.
How?
The main idea is to implement a
data-wp-router-region
directive that controls the rendered element, changing its content according to the current page.Testing Instructions
It can be tested with core blocks with the following steps:
data-wp-interactive="test"
to the corresponding HTML element.