Skip to content
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

Include drafts in finding pages key recursively #6354

Draft
wants to merge 1 commit into
base: develop-minor
Choose a base branch
from

Conversation

distantnative
Copy link
Member

This PR …

Let's think hard if this could cause any regressions or is a breaking change (not just fixing a bug).

Fixes

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and checks all pass

For review team

  • Add lab and/or sandbox examples (wherever helpful)
  • Add changes & docs to release notes draft in Notion

@distantnative distantnative added the type: bug 🐛 Is a bug; fixes a bug label Mar 23, 2024
@distantnative distantnative added this to the 4.2.0 milestone Mar 23, 2024
@distantnative distantnative requested a review from a team March 23, 2024 14:05
@distantnative distantnative self-assigned this Mar 23, 2024
@distantnative distantnative linked an issue Mar 23, 2024 that may be closed by this pull request
Copy link
Member

@lukasbestle lukasbestle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... There would suddenly no longer be a difference between HasChildren::find() and HasChildren::findPageOrDraft() anymore, right? I feel like there could be use cases where one would want to explicitly only find published pages. So this would be a breaking change and also one that wouldn't be intended I think.

Maybe we need to introduce a separate recursive finding mode that uses childrenAndDrafts(). That could then be specifically used by HasChildren::findPageOrDraft(), also allowing us to get rid of the separate search in both collections.

One way could be to have a new marker prop for Pages that keeps track of whether the collection is children, drafts or childrenAndDrafts. The same collection type would then be used in the findByKeyRecursive() method.

@distantnative distantnative added the needs: help 🙏 Really needs some help on this label Mar 24, 2024
@bastianallgeier bastianallgeier modified the milestones: 4.2.0, 4.2.x Mar 27, 2024
@distantnative distantnative marked this pull request as draft May 2, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: help 🙏 Really needs some help on this type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$site->findPageOrDraft() does not work for nested drafts
3 participants