Sort labels alphabetically on the labels popup

This commit is contained in:
Jackson Harper 2022-12-22 10:14:40 +08:00
parent 296813e773
commit cbfecca505

View file

@ -285,9 +285,13 @@ export function SetLabelsControl(props: SetLabelsControlProps): JSX.Element {
if (!labels) {
return []
}
return labels.filter((label) => {
return label.name.toLowerCase().includes(filterText.toLowerCase())
})
return labels
.filter((label) => {
return label.name.toLowerCase().includes(filterText.toLowerCase())
})
.sort((left: Label, right: Label) => {
return left.name.localeCompare(right.name)
})
}, [labels, filterText])
// Move focus through the labels list on tab or arrow up/down keys