Fix "hasNextPage" calculation for Library grid (#366)

"totalPages" could have decimal places which then would lead to incorrectly disabling the "hasNextPage" flag
This commit is contained in:
schroda
2023-06-16 00:15:00 +02:00
committed by GitHub
parent cc4bf7bb32
commit 5187d4c842

View File

@@ -120,7 +120,7 @@ const LibraryMangaGrid: React.FC<LibraryMangaGridProps & { lastLibraryUpdate: nu
const [query] = useQueryParam('query', StringParam);
const { options } = useLibraryOptionsContext();
const { unread, downloaded } = options;
const totalPages = (mangas ?? []).length / 10;
const totalPages = Math.trunc((mangas ?? []).length / 10);
const theme = useTheme();
const isLargeScreen = useMediaQuery(theme.breakpoints.up('sm'), { noSsr: true });
const defaultPageNumber = isLargeScreen ? 4 : 1;