topics are now correctly alphanumerically sorted with browsers localeCompre option "numeric: true"

This commit is contained in:
كارل مبارك 2021-10-21 13:03:53 +02:00
parent f2e705950f
commit 069859d583

View file

@ -253,14 +253,25 @@ export default createStore({
}, },
getters: { getters: {
rules: state => state.rules, rules: state => state.rules,
sortedTopics: state => (
filteredTopics: state => (
[...state.topics] [...state.topics]
.sort((a, b) => a.title.localeCompare(b.title))
.filter(t => ( .filter(t => (
t.messages.length > 0 && t.messages.length > 0 &&
t.title != 'stream events' t.title != 'stream events'
)) ))
),
sortedTopics: (state, getters) => (
getters.filteredTopics
.sort((a,b) =>
a.title.localeCompare(b.title, undefined, {
numeric : true,
sensitivity : 'base'
})
)
) )
} }