-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathReactQuery_InfiniteQuery.res
73 lines (70 loc) · 2.4 KB
/
ReactQuery_InfiniteQuery.res
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
type inifiniteQueryFunctionContext<'queryKey> = {
queryKey: 'queryKey,
pageParam: option<int>,
}
type infiniteQueryOptions<'queryKey, 'queryData, 'queryError> = {
queryKey?: 'queryKey,
queryFn?: inifiniteQueryFunctionContext<'queryKey> => Js.Promise.t<'queryData>,
enabled?: bool,
retry?: ReactQuery_Types.retryValue<'queryError>,
retryOnMount?: bool,
retryDelay?: ReactQuery_Types.retryDelayValue<'queryError>,
staleTime?: ReactQuery_Types.timeValue,
queryKeyHashFn?: 'queryKey => string,
refetchInterval?: ReactQuery_Types.refetchIntervalValue,
refetchIntervalInBackground?: bool,
refetchOnMount?: ReactQuery_Types.boolOrAlwaysValue,
refetchOnWindowFocus?: ReactQuery_Types.boolOrAlwaysValue,
refetchOnReconnect?: ReactQuery_Types.boolOrAlwaysValue,
notifyOnChangeProps?: ReactQuery_Types.notifyOnChangePropsValue,
notifyOnChangePropsExclusions?: array<string>,
onSuccess?: 'queryData => unit,
onError?: 'queryError => unit,
onSettled?: ('queryData, 'queryError) => unit,
select?: 'queryData => 'queryData,
suspense?: bool,
keepPreviousData?: bool,
structuralSharing?: bool,
useErrorBoundary?: bool,
initialData?: 'queryData => 'queryData,
initialDataUpdatedAt?: unit => int,
placeholderData?: unit => 'queryData,
getNextPageParam?: 'queryData => option<int>,
getPreviousPageParam?: 'queryData => option<int>,
}
type rec infiniteQueryResult<'queryError, 'queryData> = {
status: ReactQuery_Types.queryStatus,
isIdle: bool,
isError: bool,
isFetched: bool,
isFetchedAfterMount: bool,
isFetching: bool,
isLoading: bool,
isLoadingError: bool,
isPlaceholderData: bool,
isPreviousData: bool,
isRefetchError: bool,
isStale: bool,
isSuccess: bool,
dataUpdatedAt: int,
error: Js.Nullable.t<'queryError>,
errorUpdatedAt: int,
failureCount: int,
refetch: ReactQuery_Types.refetchOptions => Js.Promise.t<
infiniteQueryResult<'queryError, 'queryData>,
>,
remove: unit => unit,
data: option<ReactQuery_Types.infiniteData<'queryData>>,
isFetchingNextPage: bool,
isFetchingPreviousPage: bool,
fetchNextPage: unit => unit,
//fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise<UseInfiniteQueryResult>
hasNextPage: bool,
hasPreviousPage: bool,
}
@module("@tanstack/react-query")
external useInfiniteQuery: infiniteQueryOptions<
'queryKey,
'queryData,
'queryError,
> => infiniteQueryResult<'queryError, 'queryData> = "useInfiniteQuery"