fix(plugin-nested-docs): exclude descendants from parent options - #17769
fix(plugin-nested-docs): exclude descendants from parent options#17769Shweta-singh24 wants to merge 2 commits into
Conversation
|
Thanks for picking this up — the approach is right: resolving descendants with a positive Two suggestions on the implementation:
On scope, for whoever triages this: I've filed the underlying adapter bug as #17770 — |
Thanks for the review! I addressed both suggestions. Changes made: Switched descendant resolution to traverse the actual parent relationship instead of breadcrumbs. Used overrideAccess: true for the internal structural lookup. Added support for custom parentFieldSlug. Re-ran pnpm test:int:postgres plugin-nested-docs — 13/13 tests passing. Let me know if you'd like any further changes. |
What does this PR do?
Fixes #17658 by preventing a document from selecting its own descendants as its parent when using PostgreSQL.
Why?
Filtering
breadcrumbs.docwithnot_inon relational adapters can produce incorrect results because array relationships are joined and evaluated per row. This allows descendant documents to incorrectly appear in the parent picker.What changed?
breadcrumbs.docexclusion with descendant resolution using the parent relationship.id: { not_in: [...] }.parentFieldSluginto the default filter so custom parent field names (for exampleowner) are supported.Verification
Verified with PostgreSQL:
Result: 13/13 tests passing.