-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 collection sorting for grouped collections #22392
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d3a1bf1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
app/src/modules/settings/routes/data-model/field-detail/shared/related-collection-select.vue
Outdated
Show resolved
Hide resolved
app/src/modules/settings/routes/roles/item/components/permissions-overview.vue
Outdated
Show resolved
Hide resolved
@hanneskuettner It seems like non-table Groups are also present in the list when selecting a relational field, so somewhere we're not filtering those out as we should
Good question.. I'm a little conflicted. Is it better to show them in the dropdown as actual groups you have to click through to open them? Alternatively, maybe we want to prefix nested ones with a space or two and an icon? F.e.
although that'll quickly grow wider than the dropdown box 🤔 |
app/src/modules/settings/routes/data-model/field-detail/shared/related-collection-select.vue
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this LGTM.
We never addressed the idea of redesigning the UI: #22392 (comment)
However, I think that would likely balloon in scope so probably best to leave it as is.
Scope
When displaying collections (in selects, lists,
system-collection
andsystem-collections
) they were only sorted bymeta.sort
(and the collection name for ties). When grouping selections the sort index starts at1
again, so the collections appeared out of order with how you would expect it based on the data-model manual sorting.What's changed:
flattenGroupedCollections
(not sure about the name, any suggestions?) to recursively flatten a list of collections that might be (deeply) grouped with themeta.group
prop.collections
storesortedCollections
getter in addition to the originalcollections
state, that is now used instead ofcollections
whenever a sorted list of collections is needed. As such thecollections
is not modified and can be used in a backward compatible manner (also it is assigned to outside of the store, introducing the need for either areplaceCollections
or the sorted getter)Potential Risks / Drawbacks
None
Review Notes / Questions
.collections
that would result in inconsistent sorting behavior?Fixes #21658