import { type InfiniteData, type UseInfiniteQueryOptions, type UseInfiniteQueryResult } from "@tanstack/react-query"; import type { BaseRecord, CrudFilter, CrudSort, GetListResponse, HttpError, MetaQuery, Pagination, Prettify } from "../../contexts/data/types"; import type { LiveModeProps } from "../../contexts/live/types"; import type { SuccessErrorNotification } from "../../contexts/notification/types"; import type { MakeOptional } from "../../definitions/types"; import { type UseLoadingOvertimeOptionsProps, type UseLoadingOvertimeReturnType } from "../useLoadingOvertime"; export interface UseInfiniteListConfig { pagination?: Pagination; hasPagination?: boolean; filters?: CrudFilter[]; } type BaseInfiniteListProps = { /** * Metadata query for `dataProvider` */ meta?: MetaQuery; /** * Pagination properties */ pagination?: Pagination; /** * Sorter parameters */ sorters?: CrudSort[]; /** * Filter parameters */ filters?: CrudFilter[]; /** * If there is more than one `dataProvider`, you should use the `dataProviderName` that you will use */ dataProviderName?: string; }; export type UseInfiniteListQueryOptions = MakeOptional, TError, InfiniteData>>, "queryKey" | "queryFn" | "initialPageParam">; export type UseInfiniteListProps = { /** * Resource name for API data interactions */ resource: string; /** * Tanstack Query's [useInfiniteQuery](https://tanstack.com/query/v5/docs/framework/react/reference/useInfiniteQuery) options */ queryOptions?: Omit, "getNextPageParam"> & { /** * Make `getNextPageParam` optional to allow custom pagination logic */ getNextPageParam?: UseInfiniteListQueryOptions["getNextPageParam"]; }; } & BaseInfiniteListProps & SuccessErrorNotification>, TError, Prettify> & LiveModeProps & UseLoadingOvertimeOptionsProps & { onSuccess?: (data: InfiniteData>) => void; onError?: (error: TError) => void; }; export type UseInfiniteListReturnType = { query: UseInfiniteQueryResult>, TError>; result: { data: InfiniteData> | undefined; hasNextPage: boolean | undefined; hasPreviousPage: boolean | undefined; }; } & UseLoadingOvertimeReturnType; /** * `useInfiniteList` is a modified version of `react-query`'s {@link https://tanstack.com/query/latest/docs/react/guides/infinite-queries `useInfiniteQuery`} used for retrieving items from a `resource` with pagination, sort, and filter configurations. * * It uses the `getList` method as the query function from the `dataProvider` which is passed to ``. * * @see {@link https://refine.dev/docs/api-reference/core/hooks/data/useInfiniteList} for more details. * * @typeParam TQueryFnData - Result data returned by the query function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`} * @typeParam TError - Custom error object that extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#httperror `HttpError`} * @typeParam TData - Result data returned by the `select` function. Extends {@link https://refine.dev/docs/api-reference/core/interfaceReferences#baserecord `BaseRecord`}. Defaults to `TQueryFnData` * */ export declare const useInfiniteList: ({ resource: resourceFromProp, filters, pagination, sorters, queryOptions, successNotification, errorNotification, meta, liveMode, onLiveEvent, liveParams, dataProviderName, overtimeOptions, onSuccess, onError, }: UseInfiniteListProps) => UseInfiniteListReturnType; export {}; //# sourceMappingURL=useInfiniteList.d.ts.map