mirror of
https://github.com/anultravioletaurora/Jellify.git
synced 2026-05-13 00:54:02 -05:00
home screen data fixes
This commit is contained in:
@@ -24,7 +24,7 @@ export function fetchRecentlyAdded(offset?: number | undefined) : Promise<BaseIt
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchRecentlyPlayed(offset?: number | undefined): Promise<BaseItemDto[]> {
|
||||
export function fetchRecentlyPlayed(limit: number = QueryConfig.limits.recents, offset?: number | undefined): Promise<BaseItemDto[]> {
|
||||
|
||||
console.debug("Fetching recently played items");
|
||||
|
||||
@@ -35,7 +35,7 @@ export function fetchRecentlyPlayed(offset?: number | undefined): Promise<BaseIt
|
||||
BaseItemKind.Audio
|
||||
],
|
||||
startIndex: offset,
|
||||
limit: QueryConfig.limits.recents,
|
||||
limit,
|
||||
parentId: Client.library!.musicLibraryId,
|
||||
recursive: true,
|
||||
sortBy: [
|
||||
@@ -62,7 +62,7 @@ export function fetchRecentlyPlayed(offset?: number | undefined): Promise<BaseIt
|
||||
}
|
||||
|
||||
export function fetchRecentlyPlayedArtists(offset?: number | undefined) : Promise<BaseItemDto[]> {
|
||||
return fetchRecentlyPlayed(offset)
|
||||
return fetchRecentlyPlayed(QueryConfig.limits.recents * 2, offset)
|
||||
.then((tracks) => {
|
||||
return getItemsApi(Client.api!)
|
||||
.getItems({
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ImageFormat } from "@jellyfin/sdk/lib/generated-client/models";
|
||||
|
||||
export const QueryConfig = {
|
||||
limits: {
|
||||
recents: 50, // TODO: Adjust this when we add a list navigator to the end of the recents
|
||||
recents: 20,
|
||||
search: 50, // TODO: make this a paginated search so limits don't even matter
|
||||
},
|
||||
images: {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { QueryKeys } from "../../enums/query-keys";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { fetchRecentlyPlayedArtists } from "../../api/queries/functions/recents";
|
||||
import { fetchFavoriteArtists } from "../../api/queries/functions/favorites";
|
||||
import { QueryConfig } from "../../api/queries/query.config";
|
||||
|
||||
export default function Artists({
|
||||
navigation,
|
||||
@@ -22,7 +23,7 @@ export default function Artists({
|
||||
|
||||
QueryKeys.RecentlyPlayedArtists ? useQuery({
|
||||
queryKey: [QueryKeys.RecentlyPlayedArtists],
|
||||
queryFn: () => fetchRecentlyPlayedArtists(20)
|
||||
queryFn: () => fetchRecentlyPlayedArtists(QueryConfig.limits.recents)
|
||||
}) :
|
||||
|
||||
useQuery({
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fetchRecentlyPlayed } from "../../api/queries/functions/recents";
|
||||
import { fetchFavoriteTracks } from "../../api/queries/functions/favorites";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Separator } from "tamagui";
|
||||
import { QueryConfig } from "../../api/queries/query.config";
|
||||
|
||||
export default function TracksScreen({
|
||||
route,
|
||||
@@ -15,7 +16,7 @@ export default function TracksScreen({
|
||||
const { data: tracks, refetch, isPending } = useQuery({
|
||||
queryKey: [route.params.query],
|
||||
queryFn: () => route.params.query === QueryKeys.RecentlyPlayed
|
||||
? fetchRecentlyPlayed(20)
|
||||
? fetchRecentlyPlayed(QueryConfig.limits.recents * 2, 20)
|
||||
: fetchFavoriteTracks()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user