UNPKG

1.75 kBTypeScriptView Raw
1import type { InfiniteData, InfiniteQueryObserverOptions, QueryKey, RefetchOptions, RefetchQueryFilters } from '@tanstack/query-core';
2import type { WritableAtom } from 'jotai';
3import { CreateQueryOptions, GetQueryClient } from './types';
4type AtomWithInfiniteQueryAction<TQueryFnData> = {
5 type: 'refetch';
6 payload: Partial<RefetchOptions & RefetchQueryFilters<TQueryFnData>>;
7} | {
8 type: 'fetchNextPage';
9} | {
10 type: 'fetchPreviousPage';
11};
12export interface AtomWithInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey> extends InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
13 queryKey: TQueryKey;
14}
15export interface AtomWithInfiniteQueryOptionsWithEnabled<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey> extends Omit<AtomWithInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'enabled'> {
16 enabled: boolean;
17}
18export declare function atomWithInfiniteQuery<TQueryFnData, TError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(createQuery: CreateQueryOptions<AtomWithInfiniteQueryOptionsWithEnabled<TQueryFnData, TError, TData, TQueryData, TQueryKey>>, getQueryClient?: GetQueryClient): WritableAtom<InfiniteData<TData> | undefined, AtomWithInfiniteQueryAction<TQueryFnData>>;
19export declare function atomWithInfiniteQuery<TQueryFnData, TError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(createQuery: CreateQueryOptions<AtomWithInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>>, getQueryClient?: GetQueryClient): WritableAtom<InfiniteData<TData>, AtomWithInfiniteQueryAction<TQueryFnData>>;
20export {};