-
Notifications
You must be signed in to change notification settings - Fork 4.6k
iAPI: Fix duplicated nested regions #70302
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
Conversation
|
Size Change: +12 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
luisherranz
left a comment
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.
LGTM! Thanks David 🙂
|
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
left a comment
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.
Oh wait, can you include a changelog?
5be6352 to
89fbac0
Compare
|
@luisherranz, changelog updated! |
luisherranz
left a comment
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.
Perfect, thank you David!
* Add failing test * Add test to test data-wp-interactive topmost behaviour * Fix the tests * Update changelog --------- Co-authored-by: luisherranz <luisherranz@git.wordpress.org> Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
What?
Prevents duplicating nested router regions after a client-side navigation.
Nested regions may appear when an interactive block with a router region (e.g., the Query block) is placed within another interactive block with its router region (which could be another Query block instance). In this case, the nested router region is rendered twice: as part of the parent block's Preact application and as a separate Preact application, resulting in duplicated HTML.
Additionally, since a requirement of
data-wp-router-regionis that it must be in the top-mostdata-wp-interactiveelement, this PR ensures that it ignores all regions that do not meet this requirement.Why?
Nested router regions should not be processed; only the top-most region should, as nested regions become part of the same Preact application.
How?
Changing the selector to only take into account the regions that are not nested and that also include a top-most
data-wp-interactiveelement.The PR includes e2e tests for this bug fix.