ignoring load more if last page is still fetching

This commit is contained in:
Nouman Tahir 2022-11-07 16:11:07 +05:00
parent 5a86603b44
commit b29cb8bbe1

View File

@ -52,7 +52,13 @@ export const useNotificationsQuery = (filter: NotificationFilters) => {
};
const _fetchNextPage = () => {
const lastId = _getNextPageParam(notificationQueries.lastItem.data);
const lastPage = notificationQueries.lastItem;
if (!lastPage || lastPage.isFetching) {
return;
}
const lastId = _getNextPageParam(lastPage.data);
if (!pageParams.includes(lastId)) {
pageParams.push(lastId);
setPageParams([...pageParams]);