Fix #22283: child pages are not moved under parent pages - #22338
Fix #22283: child pages are not moved under parent pages#22338crazytonyli wants to merge 5 commits into
Conversation
Generated by 🚫 dangerJS |
This is necessary to get up to date with a CI configuration change that requires running on Xcode 15.1. See #22270
|
| App Name | WordPress Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr22338-3839c2f | |
| Version | 23.9 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 3839c2f | |
| App Center Build | WPiOS - One-Offs #8355 |
|
| App Name | Jetpack Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr22338-3839c2f | |
| Version | 23.9 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 3839c2f | |
| App Center Build | jetpack-installable-builds #7378 |
|
Hey @crazytonyli 👋 You might notice a merge Don't hesitate to ping me if there's any trouble. I hope to get to review this before the end of the day as it would be ideal to include it in 24.0 |
mokagio
left a comment
There was a problem hiding this comment.
@crazytonyli I run this branch locally but didn't get the pages sorted hierarchically in the UI 🤔
| iOS | Web |
|---|---|
![]() |
![]() |
Semi-related, not all pages appear in the "Set parent" menu in the app, while they do on the web.
RPReplay_Final1704697339.MP4
|
@mokagio 🤦♂️ My brain obviously wasn't working on my first day back. |
LOL. I know the feeling 😄 🤝 |




Issue
See #22283 for the issue. The issue is pretty easy to reproduce and it's my mistake that I didn't double check the app after a refactor. For context, the issue happens when a child page presents before a parent page in a pages array, which should be pretty common.
Details
When building a page tree, the elements in a pages array are processed one by one. When a child page is processed before its parent page, it is treated as an "orphan node" util it's parent page is later added to the tree. When adding the parent page to the tree, we should look up the existing orphan nodes and moving child pages under the parent page node. This logic is implemented in the
relocateOrphanNodes(to:)function. However, during a refactor, I placed this function call in an incorrect place, which led to the bug in the app.Regression Notes
Potential unintended areas of impact
None.
What I did to test those areas of impact (or what existing automated tests I relied on)
Verified the issue is fixed using a test site.
What automated tests I added (or what prevented me from doing so)
A couple of unit tests that can reproduce the issue.
PR submission checklist:
RELEASE-NOTES.txtif necessary.UI Changes testing checklist: N/A