From 9806d2f55313f0a64f9b85cd0ada68b46ead3fb7 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Sun, 28 Jun 2026 17:36:14 -0700 Subject: [PATCH] fix: require all sorts to have default value --- .../artists/hooks/use-album-artist-list-filters.ts | 7 +++++-- .../features/artists/hooks/use-artist-list-filters.ts | 2 +- .../features/genres/hooks/use-genre-list-filters.ts | 2 +- .../features/playlists/hooks/use-playlist-list-filters.ts | 5 ++++- src/renderer/features/shared/hooks/use-sort-by-filter.ts | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/renderer/features/artists/hooks/use-album-artist-list-filters.ts b/src/renderer/features/artists/hooks/use-album-artist-list-filters.ts index ba904f104..432bdab6c 100644 --- a/src/renderer/features/artists/hooks/use-album-artist-list-filters.ts +++ b/src/renderer/features/artists/hooks/use-album-artist-list-filters.ts @@ -7,11 +7,14 @@ import { useSortOrderFilter } from '/@/renderer/features/shared/hooks/use-sort-o import { FILTER_KEYS } from '/@/renderer/features/shared/utils'; import { setMultipleSearchParams } from '/@/renderer/utils/query-params'; import { runInUrlTransition } from '/@/renderer/utils/url-transition'; -import { AlbumArtistListSort } from '/@/shared/types/domain-types'; +import { AlbumArtistListSort, ArtistListSort } from '/@/shared/types/domain-types'; import { ItemListKey } from '/@/shared/types/types'; export const useAlbumArtistListFilters = () => { - const { sortBy } = useSortByFilter(null, ItemListKey.ALBUM_ARTIST); + const { sortBy } = useSortByFilter( + ArtistListSort.NAME, + ItemListKey.ALBUM_ARTIST, + ); const { sortOrder } = useSortOrderFilter(null, ItemListKey.ALBUM_ARTIST); diff --git a/src/renderer/features/artists/hooks/use-artist-list-filters.ts b/src/renderer/features/artists/hooks/use-artist-list-filters.ts index 0c9c56758..c03f28ab0 100644 --- a/src/renderer/features/artists/hooks/use-artist-list-filters.ts +++ b/src/renderer/features/artists/hooks/use-artist-list-filters.ts @@ -7,7 +7,7 @@ import { ArtistListSort } from '/@/shared/types/domain-types'; import { ItemListKey } from '/@/shared/types/types'; export const useArtistListFilters = () => { - const { sortBy } = useSortByFilter(null, ItemListKey.ARTIST); + const { sortBy } = useSortByFilter(ArtistListSort.NAME, ItemListKey.ARTIST); const { sortOrder } = useSortOrderFilter(null, ItemListKey.ARTIST); diff --git a/src/renderer/features/genres/hooks/use-genre-list-filters.ts b/src/renderer/features/genres/hooks/use-genre-list-filters.ts index d329275b2..83bd9694c 100644 --- a/src/renderer/features/genres/hooks/use-genre-list-filters.ts +++ b/src/renderer/features/genres/hooks/use-genre-list-filters.ts @@ -6,7 +6,7 @@ import { GenreListSort } from '/@/shared/types/domain-types'; import { ItemListKey } from '/@/shared/types/types'; export const useGenreListFilters = () => { - const { sortBy } = useSortByFilter(null, ItemListKey.GENRE); + const { sortBy } = useSortByFilter(GenreListSort.NAME, ItemListKey.GENRE); const { sortOrder } = useSortOrderFilter(null, ItemListKey.GENRE); diff --git a/src/renderer/features/playlists/hooks/use-playlist-list-filters.ts b/src/renderer/features/playlists/hooks/use-playlist-list-filters.ts index 7b624bc3c..a2b05f294 100644 --- a/src/renderer/features/playlists/hooks/use-playlist-list-filters.ts +++ b/src/renderer/features/playlists/hooks/use-playlist-list-filters.ts @@ -11,7 +11,10 @@ import { PlaylistListSort } from '/@/shared/types/domain-types'; import { ItemListKey } from '/@/shared/types/types'; export const usePlaylistListFilters = () => { - const sortByFilter = useSortByFilter(null, ItemListKey.PLAYLIST); + const sortByFilter = useSortByFilter( + PlaylistListSort.NAME, + ItemListKey.PLAYLIST, + ); const sortOrderFilter = useSortOrderFilter(null, ItemListKey.PLAYLIST); const { searchTerm, setSearchTerm } = useSearchTermFilter(''); diff --git a/src/renderer/features/shared/hooks/use-sort-by-filter.ts b/src/renderer/features/shared/hooks/use-sort-by-filter.ts index 8e3c5806c..f7c34e20b 100644 --- a/src/renderer/features/shared/hooks/use-sort-by-filter.ts +++ b/src/renderer/features/shared/hooks/use-sort-by-filter.ts @@ -8,7 +8,7 @@ import { parseStringParam, setSearchParam } from '/@/renderer/utils/query-params import { runInUrlTransition } from '/@/renderer/utils/url-transition'; import { ItemListKey } from '/@/shared/types/types'; -export const useSortByFilter = (defaultValue: null | string, listKey: ItemListKey) => { +export const useSortByFilter = (defaultValue: string, listKey: ItemListKey) => { const server = useCurrentServer(); const { getFilter, setFilter } = useListFilterPersistence(server.id, listKey); const [searchParams, setSearchParams] = useSearchParams();