1
- type inifiniteQueryFunctionContext <'queryKey , 'pageParam > = {
2
- queryKey : array < 'queryKey > ,
3
- pageParam : option <'pageParam >,
1
+ type inifiniteQueryFunctionContext <'queryKey > = {
2
+ queryKey : 'queryKey ,
3
+ pageParam : option <int >,
4
4
}
5
5
6
- @deriving (abstract )
7
- type infiniteQueryOptions <'queryKey , 'queryData , 'queryError , 'pageParam > = {
8
- @optional queryKey : 'queryKey ,
9
- @optional
10
- queryFn : inifiniteQueryFunctionContext <'queryKey , 'pageParam > => Js .Promise .t <'queryData >,
11
- @optional enabled : bool ,
12
- @optional retry : ReactQuery_Types .retryValue <'queryError >,
13
- @optional retryOnMount : bool ,
14
- @optional retryDelay : ReactQuery_Types .retryDelayValue <'queryError >,
15
- @optional staleTime : ReactQuery_Types .timeValue ,
16
- @optional queryKeyHashFn : 'queryKey => string ,
17
- @optional refetchInterval : ReactQuery_Types .refetchIntervalValue ,
18
- @optional refetchIntervalInBackground : bool ,
19
- @optional refetchOnMount : ReactQuery_Types .boolOrAlwaysValue ,
20
- @optional refetchOnWindowFocus : ReactQuery_Types .boolOrAlwaysValue ,
21
- @optional refetchOnReconnect : ReactQuery_Types .boolOrAlwaysValue ,
22
- @optional notifyOnChangeProps : ReactQuery_Types .notifyOnChangePropsValue ,
23
- @optional notifyOnChangePropsExclusions : array <string >,
24
- @optional onSuccess : 'queryData => unit ,
25
- @optional onError : 'queryError => unit ,
26
- @optional onSettled : ('queryData , 'queryError ) => unit ,
27
- @optional select : 'queryData => 'queryData ,
28
- @optional suspense : bool ,
29
- @optional keepPreviousData : bool ,
30
- @optional structuralSharing : bool ,
31
- @optional useErrorBoundary : bool ,
32
- @optional initialData : 'queryData => 'queryData ,
33
- @optional initialDataUpdatedAt : unit => int ,
34
- @optional placeholderData : unit => 'queryData ,
35
- @optional getNextPageParam : ('pageParam , array <'pageParam >) => option <'pageParam >,
36
- @optional getPreviousPageParam : ('pageParam , array <'pageParam >) => option <'pageParam >,
6
+ type infiniteQueryOptions <'queryKey , 'queryData , 'queryError > = {
7
+ queryKey ?: 'queryKey ,
8
+ queryFn ?: inifiniteQueryFunctionContext <'queryKey > => Js .Promise .t <'queryData >,
9
+ enabled ?: bool ,
10
+ retry ?: ReactQuery_Types .retryValue <'queryError >,
11
+ retryOnMount ?: bool ,
12
+ retryDelay ?: ReactQuery_Types .retryDelayValue <'queryError >,
13
+ staleTime ?: ReactQuery_Types .timeValue ,
14
+ queryKeyHashFn ?: 'queryKey => string ,
15
+ refetchInterval ?: ReactQuery_Types .refetchIntervalValue ,
16
+ refetchIntervalInBackground ?: bool ,
17
+ refetchOnMount ?: ReactQuery_Types .boolOrAlwaysValue ,
18
+ refetchOnWindowFocus ?: ReactQuery_Types .boolOrAlwaysValue ,
19
+ refetchOnReconnect ?: ReactQuery_Types .boolOrAlwaysValue ,
20
+ notifyOnChangeProps ?: ReactQuery_Types .notifyOnChangePropsValue ,
21
+ notifyOnChangePropsExclusions ?: array <string >,
22
+ onSuccess ?: 'queryData => unit ,
23
+ onError ?: 'queryError => unit ,
24
+ onSettled ?: ('queryData , 'queryError ) => unit ,
25
+ select ?: 'queryData => 'queryData ,
26
+ suspense ?: bool ,
27
+ keepPreviousData ?: bool ,
28
+ structuralSharing ?: bool ,
29
+ useErrorBoundary ?: bool ,
30
+ initialData ?: 'queryData => 'queryData ,
31
+ initialDataUpdatedAt ?: unit => int ,
32
+ placeholderData ?: unit => 'queryData ,
33
+ getNextPageParam ?: 'queryData => option <int >,
34
+ getPreviousPageParam ?: 'queryData => option <int >,
37
35
}
38
36
39
- type rec infiniteQueryResult <'queryError , 'queryData , 'pageParam > = {
37
+ type rec infiniteQueryResult <'queryError , 'queryData > = {
40
38
status : ReactQuery_Types .queryStatus ,
41
39
isIdle : bool ,
42
40
isError : bool ,
@@ -55,22 +53,21 @@ type rec infiniteQueryResult<'queryError, 'queryData, 'pageParam> = {
55
53
errorUpdatedAt : int ,
56
54
failureCount : int ,
57
55
refetch : ReactQuery_Types .refetchOptions => Js .Promise .t <
58
- infiniteQueryResult <'queryError , 'queryData , 'pageParam >,
56
+ infiniteQueryResult <'queryError , 'queryData >,
59
57
>,
60
58
remove : unit => unit ,
61
- data : ReactQuery_Types .infiniteData <'queryData , 'pageParam >,
59
+ data : option < ReactQuery_Types .infiniteData <'queryData > >,
62
60
isFetchingNextPage : bool ,
63
61
isFetchingPreviousPage : bool ,
64
- // fetchNextPage: (options?: FetchNextPageOptions) => Promise<UseInfiniteQueryResult>
62
+ fetchNextPage : unit => unit ,
65
63
//fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise<UseInfiniteQueryResult>
66
64
hasNextPage : bool ,
67
65
hasPreviousPage : bool ,
68
66
}
69
67
70
- @module ("react-query" )
71
- external useQuery : infiniteQueryOptions <
68
+ @module ("@tanstack/ react-query" )
69
+ external useInfiniteQuery : infiniteQueryOptions <
72
70
'queryKey ,
73
71
'queryData ,
74
72
'queryError ,
75
- 'pageParam ,
76
- > => infiniteQueryResult <'queryError , 'queryData , 'pageParam > = "useInfiniteQuery"
73
+ > => infiniteQueryResult <'queryError , 'queryData > = "useInfiniteQuery"
0 commit comments