From 710f67b0e1d89ab88072e1f82f93958d3d693cf0 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Mon, 19 Feb 2024 15:17:55 +0000 Subject: [PATCH] Filter values are in alphabetical order Fixes #204 --- apps/playnite-web/src/api/client/state/librarySlice.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/playnite-web/src/api/client/state/librarySlice.ts b/apps/playnite-web/src/api/client/state/librarySlice.ts index 755df96d4..bd38585ea 100644 --- a/apps/playnite-web/src/api/client/state/librarySlice.ts +++ b/apps/playnite-web/src/api/client/state/librarySlice.ts @@ -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, @@ -56,7 +60,7 @@ const slice = createSlice({ if (key.endsWith('FilterValues')) { acc[key.replace('FilterValues', '')] = Object.values( value as Record, - ) + ).sort(alphabeticalOrder) } return acc }, {})