Skip to content

Commit 86aca22

Browse files
authored
[Bug fix] Ensure linguistic alphabetical order for profile names (#8869)
* Ensure profiles are sorted correctly * mend Add tiebreaker for lowercase comparison * handle characters with accent marks * mend handle other languages
1 parent 94f3913 commit 86aca22

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/renderer/store/modules/profiles.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,21 @@ const getters = {
3838
},
3939
}
4040

41+
const collator = new Intl.Collator(undefined, {
42+
usage: 'sort',
43+
caseFirst: 'upper',
44+
sensitivity: 'case',
45+
numeric: true
46+
})
47+
4148
function profileSort(a, b) {
4249
if (a._id === MAIN_PROFILE_ID) return -1
4350
if (b._id === MAIN_PROFILE_ID) return 1
44-
if (a.name < b.name) return -1
45-
if (a.name > b.name) return 1
46-
return 0
51+
52+
const nameA = a.name.normalize('NFC')
53+
const nameB = b.name.normalize('NFC')
54+
55+
return collator.compare(nameA, nameB)
4756
}
4857

4958
const actions = {

0 commit comments

Comments
 (0)