You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/create-entity-api.ts
+45-1Lines changed: 45 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ import {
37
37
* @param {((pagination: Pagination, request: TSearchRequest) => number) | undefined} [options.getCurrentPage=((pagination) => pagination.currentPage)] - The function to get current page.
* Creates a query endpoint for infinite searching entities. Behaves similar to `search`:
185
185
* - A query endpoint that requests `GET /{baseEndpoint}` for searching entities.
@@ -231,6 +231,50 @@ export function createEntityApi<
231
231
}
232
232
},
233
233
}),
234
+
/**
235
+
* Creates a query endpoint for infinite searching entities.
236
+
* - A query endpoint that requests `GET /{baseEndpoint}` for searching entities.
237
+
* - Accepts request params described by `entitySearchRequestConstructor` and returns `entitySearchResponseConstructor` extending `PaginationRequest` and `PaginationResponse` respectively.
238
+
* But accumulates data from newly requested pages.
239
+
* This query can be used with `useSearchPaginatedInfiniteQuery` hook to implement infinite scrolling lists.
240
+
* It supports loading data in both directions using `fetchNextPage` and `fetchPreviousPage` callbacks, and provides other useful props.
241
+
*
242
+
* @param {TSearchRequest} params - The parameters for searching the entities.
243
+
* @return {Promise<InfiniteData<TSearchResponse, number>>} A promise that resolves to the search result.
0 commit comments