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

Fix loading of relational fields in group #17415

Merged
merged 2 commits into from
Feb 8, 2023
Merged

Fix loading of relational fields in group #17415

merged 2 commits into from
Feb 8, 2023

Conversation

Nitwel
Copy link
Member

@Nitwel Nitwel commented Feb 6, 2023

Description

The problem was that when opening the group it didn't load the children for the children in the group, thus displaying no arrows inside a group even if there are relational fields. The reason why no inner children got loaded was caused by the group not having any value which is intended as groups are alias fields.

The fix was to preload any children of children of groups and if we open a child in a group, to be able to find that child as the path is not matching the actual tree, and then to load it's children.

Here is the problem visualized:

- "field1"
- "field2"
- "" <--- Is a group but has no path as "relational-field-in-group" is top-level for the api
  - "relational-field-in-group" <--- by giving the group no path it's chidren are correct
- "field4"

When you now click on that group we would have to somehow find it in the tree with the path of "" which we can't as the path is nonsense.

The solution is to do this:

- "field1"
- "field2"
- ""
  - "relational-field-in-group" <-- we are now able to find this even though the path would in theory be "group1.relational-field-in-group".
    - "relational-field-in-group.relational-field1"
    - "relational-field-in-group.relational-field2"
- "field4"

Fixes #13899

@Nitwel Nitwel self-assigned this Feb 6, 2023
Copy link
Member

@paescuj paescuj left a comment

Choose a reason for hiding this comment

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

Fix makes sense to me 👍

@rijkvanzanten rijkvanzanten merged commit b3a755a into main Feb 8, 2023
@rijkvanzanten rijkvanzanten deleted the fix-13899 branch February 8, 2023 15:18
@rijkvanzanten rijkvanzanten added this to the Next Release milestone Feb 28, 2023
meditadvisors pushed a commit to ciso360ai/directus-mod that referenced this pull request Mar 3, 2023
* Fix loading of relational fields in group

* run linter
ThinkZ pushed a commit to ThinkZ/directus-view that referenced this pull request Mar 29, 2023
* Fix loading of relational fields in group

* run linter
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy of M2M Relation not showing when inside a group field
3 participants