mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
stop making requests for projects if lastPage did not reach per_page limit
This commit is contained in:
@@ -45,12 +45,18 @@ const useInfiniteProjectsScroll = ( { params: newInputParams, enabled }: object
|
|||||||
}
|
}
|
||||||
return searchProjects( params, optsWithAuth );
|
return searchProjects( params, optsWithAuth );
|
||||||
},
|
},
|
||||||
|
// TO DO: we need to properly type queryOptions in useAuthenticatedInfiniteQuery
|
||||||
|
/* eslint-disable consistent-return */
|
||||||
{
|
{
|
||||||
getNextPageParam: lastPage => ( lastPage
|
getNextPageParam: lastPage => {
|
||||||
? lastPage.page + 1
|
if ( !lastPage || lastPage.results.length < 20 ) {
|
||||||
: 1 ),
|
return undefined;
|
||||||
|
}
|
||||||
|
return lastPage.page + 1;
|
||||||
|
},
|
||||||
enabled
|
enabled
|
||||||
}
|
}
|
||||||
|
/* eslint-enable consistent-return */
|
||||||
);
|
);
|
||||||
|
|
||||||
const pages = data?.pages;
|
const pages = data?.pages;
|
||||||
|
|||||||
Reference in New Issue
Block a user