Fixed order by and sorting
This commit is contained in:
parent
89d4c026c5
commit
f31ea55ca0
1 changed files with 9 additions and 5 deletions
|
|
@ -267,12 +267,16 @@ const grouped = computed<{ name: string, items: YTDLPOption[] }[]>(() => {
|
||||||
map.get(key)!.push(o)
|
map.get(key)!.push(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
const out = Array.from(map.entries()).map(([name, items]) => {
|
const dir = 'asc' === sortDir.value ? 1 : -1
|
||||||
items.sort((a, b) => (a.flags[0] || '').localeCompare(b.flags[0] || ''))
|
const out = Array.from(map.entries()).map(([name, items]) => ({ name, items }))
|
||||||
return { name, items }
|
|
||||||
})
|
if ('group' === sortBy.value) {
|
||||||
|
out.sort((a, b) => a.name.localeCompare(b.name) * dir)
|
||||||
|
} else {
|
||||||
|
// When sorting by flag, groups should still be in alphabetical order
|
||||||
|
out.sort((a, b) => a.name.localeCompare(b.name))
|
||||||
|
}
|
||||||
|
|
||||||
out.sort((a, b) => a.name.localeCompare(b.name))
|
|
||||||
return out
|
return out
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue