fix: sort root nodes unless opted out via suppressAlphabeticalSorting#1753
fix: sort root nodes unless opted out via suppressAlphabeticalSorting#1753HendrikThePendric wants to merge 3 commits into
Conversation
|
|
🚀 Deployed on https://pr-1753--dhis2-ui.netlify.app |
tomzemp
left a comment
There was a problem hiding this comment.
Looks good to me @HendrikThePendric 🙏 . I've read through the code and tested in the users app (data entry app has custom org unit tree, so we'll need to copy these changes).
The only thing I noticed on review is that the existing helper function sortNodeChildrenAlphabetically is using left.displayName.localeCompare(right.displayName). I guess this then uses the sorting conventions of the browser language, whereas we might want to use the user's ui language? This can cause some differences in the sort, e.g. English would alphabetise [Åland, Belgium, Zimbabwe] whereas Norwegian would alphabetise [Belgium, Zimbabwe, Åland] (or English [na,ño,ny], vs Spanish [na,ny,ño]). I think this is a minor issue, but might be nice to fix in the context of this PR?



Implements LIBS-864
Description
Root nodes are now sorted alphabetically unless opted out via
suppressAlphabeticalSorting. I've scoped this as a fix, because I'd say that this behaviour should have been implemented all along. Sorting children but not roots, while having a genericsuppressAlphabeticalSortingprop in place is inconsistent behaviour.Incidental
yarn setup. Not sure why it didn't get added before, but it seems like a valid addition to me.Checklist