fix(recommendations): only load more titles if there can be more than 40 (#2749)

* fix: fixed recommendations page causing infinite network requests to tmdb api

TMDB API would only return 40 results and the recommendations page expected more. This would cause
an infinite amount of network requests. I set a limit specifically for this solving the problem.

fix #2710
pull/2753/head
Brandon Cohen 3 years ago committed by GitHub
parent 1054b4e2d7
commit 14519ef555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,7 +82,9 @@ const useDiscover = <T extends BaseMedia, S = Record<string, never>>(
const isEmpty = !isLoadingInitialData && titles?.length === 0; const isEmpty = !isLoadingInitialData && titles?.length === 0;
const isReachingEnd = const isReachingEnd =
isEmpty || (!!data && (data[data?.length - 1]?.results.length ?? 0) < 20); isEmpty ||
(!!data && (data[data?.length - 1]?.results.length ?? 0) < 20) ||
(!!data && (data[data?.length - 1]?.totalResults ?? 0) < 41);
return { return {
isLoadingInitialData, isLoadingInitialData,

Loading…
Cancel
Save