feat: use function hooks instead of class hooks

This commit is contained in:
Kingkor Roy Tirtho
2023-02-26 10:51:28 +06:00
parent d964216ee1
commit 1ea9370570
8 changed files with 140 additions and 578 deletions
@@ -110,6 +110,7 @@ class QueryClient {
)
.cast<DataType, ErrorType, PageType>();
query.updateQueryFn(queryFn);
query.updateNextPageFn(nextPage);
cache.addInfiniteQuery(query);
return query;
}
@@ -314,6 +314,7 @@ class InfiniteQuery<DataType, ErrorType, PageType>
}
void updateNextPageFn(InfiniteQueryNextPage<DataType, PageType> nextPage) {
if (state._nextPage == nextPage) return;
state = state.copyWith(nextPage: nextPage);
}