fix(frontend): filter relationship selectors by common_parent - #10039
Merged
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 15 files
Shadow auto-approve: would not auto-approve because issues were found.
Re-trigger cubic
pa-lem
force-pushed
the
ple-ifc-1646-common-parent-filter
branch
5 times, most recently
from
July 28, 2026 06:36
755a54b to
a33c32c
Compare
bilalabbad
reviewed
Jul 28, 2026
Relationship selectors in object forms now honor the `common_parent` schema property: options are filtered to peers that share the same parent as the value picked for the referenced relationship in the same form, instead of listing every peer. - Add useCommonParentFilter hook: watches the sibling common_parent field and derives a single-hop `<X>__ids` filter (plus a matching RelationshipInput parent shape). - Apply across the many, node, generic, and hierarchical relationship fields. - Hide the manual parent picker on cardinality-one fields when common_parent is set, since the parent is then driven by the sibling field. Keep the selection consistent with the filter so it can't be bypassed: - Clear the current selection when the chosen parent changes (a peer valid under the old parent no longer satisfies the constraint). - Pre-fill the inline "Add new" create form with the chosen parent, so a peer created there satisfies the constraint instead of being an escape hatch. - Keep the filter applied on UUID searches (opt-in), and drop the hierarchical "Explore" tree tab, which browses a different axis and can't honor the filter. Fixes IFC-1646. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pa-lem
force-pushed
the
ple-ifc-1646-common-parent-filter
branch
from
July 28, 2026 14:02
a33c32c to
8aa0114
Compare
bilalabbad
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes IFC-1646. Relationship selectors in object create/edit forms now honor the
common_parentschema property. When a relationship declarescommon_parent: <X>, its options are filtered to peers that resolve their<X>parent to the same object the user picked for the<X>relationship in the same form — instead of listing every peer (which previously let users pick invalid peers and hit a backend validation error on submit).Previously the
common_parentproperty was carried into the frontend types but no filtering logic consumed it.Changes
useCommonParentFilterhook — watches the sibling<X>field via react-hook-formuseWatch, derives the chosen parent id, and returns a single-hop filter in two shapes: afilterQuery({ <X>__ids: [id] }) for the many/hierarchical inputs and aparentobject forRelationshipInput(cardinality one). Uses a sentinel watch name so the hook stays unconditional without subscribing to the whole form.common_parentis set, since the parent is then driven by the sibling field (avoids a redundant, potentially contradictory control).Keeping the selection consistent with the filter (no bypasses)
initialObject→ObjectForm'scurrentObject) so a peer created there already satisfies the constraint, instead of being an escape hatch. The seed only applies once a parent is selected.enforceFilterQueryOnIdSearch), so pasting an out-of-parent UUID no longer bypasses the constraint. Other callers keep the existing UUID-override behavior.common_parentapplies, because the tree browses the peer's own hierarchy (a different axis) and can't honor the filter.Testing
biome,betterer ci,knip, and the form + relationships vitest suites.🤖 Generated with Claude Code