use constant for per_page param

This commit is contained in:
Abbey Campbell
2025-12-16 13:13:43 -08:00
parent e9e2a7e842
commit ded03d1bac

View File

@@ -4,10 +4,12 @@ import {
useAuthenticatedInfiniteQuery
} from "sharedHooks";
const ITEMS_PER_PAGE = 20;
const useInfiniteProjectsScroll = ( { params: newInputParams, enabled }: object ): object => {
const baseParams = {
...newInputParams,
per_page: 20,
per_page: ITEMS_PER_PAGE,
ttl: -1,
rule_details: true,
fields: {
@@ -49,7 +51,7 @@ const useInfiniteProjectsScroll = ( { params: newInputParams, enabled }: object
/* eslint-disable consistent-return */
{
getNextPageParam: lastPage => {
if ( !lastPage || lastPage.results.length < 20 ) {
if ( !lastPage || lastPage.results.length < ITEMS_PER_PAGE ) {
return undefined;
}
return lastPage.page + 1;