Fix collection sorting for grouped collections #22392
Draft
+129
−87
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.
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