fix crashes due to type error when using persisted data (#375)

This commit is contained in:
Violet Caulfield
2025-05-18 12:59:39 -05:00
committed by GitHub
parent 6110c14bf0
commit bfded53a40
3 changed files with 4 additions and 2 deletions

View File

@@ -81,4 +81,6 @@ export enum QueryKeys {
StorageInUse = 'StorageInUse',
Patrons = 'Patrons',
AllArtistsAlphabetical = 'AllArtistsAlphabetical',
AllAlbumsAlphabetical = 'AllAlbumsAlphabetical',
RecentlyAddedAlbums = 'RecentlyAddedAlbums',
}

View File

@@ -31,7 +31,7 @@ const DiscoverContextInitializer = () => {
isPending: isPendingRecentlyAdded,
isFetchingNextPage: isFetchingNextRecentlyAdded,
} = useInfiniteQuery({
queryKey: [QueryKeys.RecentlyAdded],
queryKey: [QueryKeys.RecentlyAddedAlbums],
queryFn: ({ pageParam }) => fetchRecentlyAdded(api, library, pageParam),
select: (data) => data.pages.flatMap((page) => page),
getNextPageParam: (lastPage, pages) => (lastPage.length > 0 ? pages.length + 1 : undefined),

View File

@@ -149,7 +149,7 @@ const LibraryContextInitializer = () => {
isFetchingNextPage: isFetchingNextAlbumsPage,
hasNextPage: hasNextAlbumsPage,
} = useInfiniteQuery({
queryKey: [QueryKeys.AllAlbums, isFavorites, sortDescending],
queryKey: [QueryKeys.AllAlbumsAlphabetical, isFavorites, sortDescending],
queryFn: ({ pageParam }) =>
fetchAlbums(
api,