ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
45 lines • 2.42 kB
TypeScript
import type { InfiniteQueryObserverBaseResult, InfiniteData } from '@tanstack/react-query';
import type { UseInfiniteGetListOptions } from '../../dataProvider';
import type { ListControllerResult } from './useListController';
import type { RaRecord, SortPayload, FilterPayload, Exporter, GetInfiniteListResult } from '../../types';
/**
* Prepare data for the InfiniteList view
*
* @param {Object} props The props passed to the InfiniteList component.
*
* @return {Object} controllerProps Fetched and computed data for the List view
*
* @example
*
* import { useInfiniteListController } from 'react-admin';
* import ListView from './ListView';
*
* const MyList = props => {
* const controllerProps = useInfiniteListController(props);
* return <ListView {...controllerProps} {...props} />;
* }
*/
export declare const useInfiniteListController: <RecordType extends RaRecord<import("../../types").Identifier> = any, ErrorType = Error>(props?: InfiniteListControllerProps<RecordType, ErrorType>) => InfiniteListControllerResult<RecordType, ErrorType>;
export interface InfiniteListControllerProps<RecordType extends RaRecord = any, ErrorType = Error> {
debounce?: number;
disableAuthentication?: boolean;
/**
* Whether to disable the synchronization of the list parameters with the current location (URL search parameters)
*/
disableSyncWithLocation?: boolean;
exporter?: Exporter | false;
filter?: FilterPayload;
filterDefaultValues?: object;
perPage?: number;
queryOptions?: UseInfiniteGetListOptions<RecordType, ErrorType>;
resource?: string;
sort?: SortPayload;
storeKey?: string | false;
}
export type InfiniteListControllerResult<RecordType extends RaRecord = any, ErrorType = Error> = ListControllerResult<RecordType> & {
fetchNextPage: InfiniteQueryObserverBaseResult<InfiniteData<GetInfiniteListResult<RecordType>>, ErrorType>['fetchNextPage'];
fetchPreviousPage: InfiniteQueryObserverBaseResult<InfiniteData<GetInfiniteListResult<RecordType>>, ErrorType>['fetchPreviousPage'];
isFetchingNextPage: InfiniteQueryObserverBaseResult<InfiniteData<GetInfiniteListResult<RecordType>>, ErrorType>['isFetchingNextPage'];
isFetchingPreviousPage: InfiniteQueryObserverBaseResult<InfiniteData<GetInfiniteListResult<RecordType>>, ErrorType>['isFetchingPreviousPage'];
};
//# sourceMappingURL=useInfiniteListController.d.ts.map