From d5442b8b21c302651faf2f08b87ad9187db354d1 Mon Sep 17 00:00:00 2001 From: Maru Date: Thu, 16 Nov 2023 19:59:28 +0900 Subject: [PATCH] Fix infiniteQuery page offset --- src/modules/services/channels.service.ts | 2 +- src/modules/services/discovery.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/services/channels.service.ts b/src/modules/services/channels.service.ts index b107de21..36850571 100644 --- a/src/modules/services/channels.service.ts +++ b/src/modules/services/channels.service.ts @@ -33,7 +33,7 @@ export function useChannelListForOrg( }, { getNextPageParam: (lastPage, pages) => - lastPage.length === 100 ? pages.length + 1 : null, + lastPage.length === 100 ? pages.length : null, keepPreviousData: true, retry: 1, cacheTime: 1000 * 60 * 60 * 5, diff --git a/src/modules/services/discovery.service.ts b/src/modules/services/discovery.service.ts index 15921936..74779c74 100644 --- a/src/modules/services/discovery.service.ts +++ b/src/modules/services/discovery.service.ts @@ -81,7 +81,7 @@ export function useAllPlaylistDiscoveryForOrg( { ...options, getNextPageParam: (lastPage, pages) => - lastPage.length === 100 ? pages.length + 1 : null, + lastPage.length === 100 ? pages.length : null, keepPreviousData: options.keepPreviousData ?? true, retry: options.retry ?? 1, cacheTime: options.cacheTime ?? 1000 * 60 * 60 * 5, @@ -125,7 +125,7 @@ export function useAllPlaylistDiscoveryForFavorites( ...options, enabled: isLoggedIn && options.enabled, getNextPageParam: (lastPage, pages) => - lastPage.length === 100 ? pages.length + 1 : null, + lastPage.length === 100 ? pages.length : null, keepPreviousData: options.keepPreviousData ?? true, retry: options.retry ?? 1, cacheTime: options.cacheTime ?? 1000 * 60 * 60 * 5,