feat: sort tags alphabetically (#1818)

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-01-30 22:10:30 +01:00 committed by GitHub
parent e671aa4aa8
commit 566b3009b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,10 @@ export const TagSelectionInput: React.FC = () => {
const historyEntries = useApplicationState((state) => state.history) const historyEntries = useApplicationState((state) => state.history)
const tags = useMemo<string[]>(() => { const tags = useMemo<string[]>(() => {
const allTags = historyEntries.map((entry) => entry.tags).flat() const allTags = historyEntries
.map((entry) => entry.tags)
.flat()
.sort((first, second) => first.toLowerCase().localeCompare(second.toLowerCase()))
return Array.from(new Set(allTags)) return Array.from(new Set(allTags))
}, [historyEntries]) }, [historyEntries])