Skip to content

Commit

Permalink
Filter values are in alphabetical order (#217)
Browse files Browse the repository at this point in the history
Fixes #204
  • Loading branch information
andrew-codes authored Feb 19, 2024
2 parents 6e12c4f + 710f67b commit a808c03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/playnite-web/src/api/client/state/librarySlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const getFeatureFilter = memoize((state: typeof initialState) => {
: new And(...state.activeFeatureFilters.map((id) => new MatchFeature(id)))
})

const alphabeticalOrder = (a: { name: string }, b: { name: string }) => {
return a.name.localeCompare(b.name)
}

const slice = createSlice({
name: 'library',
initialState,
Expand All @@ -56,7 +60,7 @@ const slice = createSlice({
if (key.endsWith('FilterValues')) {
acc[key.replace('FilterValues', '')] = Object.values(
value as Record<string, { id: string; name: string }>,
)
).sort(alphabeticalOrder)
}
return acc
}, {})
Expand Down

0 comments on commit a808c03

Please sign in to comment.